I need to check if a user has read level access to a particular list Item. What would be the best approach


listItem.DoesUserHavePermissions(currentUser, SPBasePermissions.ViewListItems);
//here there is also SPBasePermissions.OpenItems..so which one to use
listItem.DoesUserHavePermissions(currentUser, SPBasePermissions.OpenItems);

2) Or is it best to get through SPRoleAssignment & SPRoleDefinition


You can use EffectiveBasePermissions to get the effective base permissions of the current user for a particular list

(MyList.EffectiveBasePermissions & SPBasePermissions.ViewListItems) != SPBasePermissions.EmptyMask

For a particular item (normally under broken inheritance):

Listitem.DoesUserHavePermissions(myuser, SPBasePermissions.ViewListItems) &&
                                Listitem.DoesUserHavePermissions(myuser, SPBasePermissions.OpenItems);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.