Add a new custom group to the site using Client Object Model


using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
Microsoft.SharePoint;
using
Microsoft.SharePoint.Client;
namespace
ClientObjectModel
{
class Program
{
static void Main(string[] args)
{
// Add a new custom group to the site
string siteURL = "http://serverName:1111/sites/SPSiteDataQuery/";
ClientContext context = new ClientContext(siteURL);
GroupCreationInformation groupCreationInfo = new GroupCreationInformation();
groupCreationInfo.Title =
"Custom group";
groupCreationInfo.Description =
" My Custom Group";
Group group = context.Web.SiteGroups.Add(groupCreationInfo);
context.ExecuteQuery();
}
}
}
Ebook Download
View all
Learn
View all