i am using a CAML Queryy to get all the list items that are cotains a ContentType, but i also need to know if the Current user, has permissions to see that file.
That part i do not know how can i check it.
i use this exmpla as reference of how to get the items related to a content type.
Thanks.
Per default in SharePoint our code runs impersonated as the user executing the web request. Thus the items returned by the CAML query are already security trimmed. Meaning, the result set only contains items the current user is allowed to “see”.
Under some circumstances you are required to execute the CAML query with system priveliges. To do so the
SPSiteobject has to be opend with the system account token:In that case you could check / ensure permissions on a certain list item with the method
DoesUserHavePermissions:Important to note is that you have to call the overload of the
DoesUserHavePermissionswith theSPUserargument. The overload without will use the “current user” of the site. Which is the system account since the site was opened with the system account token.