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)
{
//Assign the custom permission Level to the group
string siteURL = "http://serverName:1111/sites/SPSiteDataQuery/";
ClientContext context = new ClientContext(siteURL);
GroupCollection groupColl = context.Web.SiteGroups;
Group group = groupColl.GetById(7);
RoleDefinition roleDefinition=context.Web.RoleDefinitions.GetByName("Custom Permission Level");
RoleDefinitionBindingCollection roleDefinitionBindingColl=new RoleDefinitionBindingCollection (context);
roleDefinitionBindingColl.Add(roleDefinition);
RoleAssignment roleAssign=context.Web.RoleAssignments.Add(group,roleDefinitionBindingColl);
context.ExecuteQuery();
}
}
}