I want to check if specific user has which permission for specific file or folder of any document library in share point client object model.
-
javascript, c#, powershell??– Salvatore Di FazioMay 21, 2014 at 11:11
-
I want code for c#– user25864May 21, 2014 at 14:09
1 Answer
SPlistitem has a function DoesuserhavePermission, http://msdn.microsoft.com/en-us/library/ms472022.aspx
try this one,
SPList objList = web.GetList(this.NewsItemURL);
SPListItem objListItem = null;
try
{
objListItem = objList.GetItemById(_intNewsItemID);
if (!objListItem.DoesUserHavePermissions(web.CurrentUser, SPBasePermissions.ViewListItems))
{
_strErrMsg = "Does not have permission";
}
}
catch (ArgumentException)
{
objListItem = null;
}
Also very good article. http://melick-rajee.blogspot.com/2013/11/how-to-check-user-permission-for-web.html