Visit our SharePoint Forum

SharePoint developer? Submit Yourself as Freelancer

Monday, July 26, 2010

Get Item level Permissions using Client Object model SHarePoint 2010

Here is a little code snippet to get the info about the users who have permission for a specific item in a list

Retrieving permissions for a Specific item -

private void GetItemPermission()
SecurableObject curObj = null;
ListItem curItem = ctx.Web.Lists.GetByTitle(“My List”).GetItemById(ItemId); -> Use ItemId of the Item.
//plug it into our query objectcurObj = curItem as SecurableObject;
IEnumerable roles = null;
roles = ctx.LoadQuery(
roleAsg => roleAsg.Member,
roleAsg => roleAsg.RoleDefinitionBindings.Include(
roleDef => roleDef.Name, // for each role def, include roleDef’s Name
roleDef => roleDef.Description)));


courtz said...

this doesnt seem to work in javascript? im trying to enable or disable a ribbon item using the "enabledscript" tag, something like this:

EnabledScript="javascript:function multipleEnableEdit()
var items = SP.ListOperation.Selection.getSelectedItems(ctx);

var kx;
var ci = CountDictionary(items);
if(ci >= 1){
for (kx in items)

//cycle thru the items

how would this be done using the above code, since its not written in javascript

SharePoint Programming