Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6075849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:32:25+00:00 2026-05-23T10:32:25+00:00

i am using a CAML Queryy to get all the list items that are

  • 0

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.

https://sharepoint.stackexchange.com/questions/14566/how-to-find-all-documents-of-a-certain-content-type

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:32:25+00:00Added an answer on May 23, 2026 at 10:32 am

    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 SPSite object has to be opend with the system account token:

    using (SPSite elevatedSite = new SPSite("http://server-url", SPUserToken.SystemAccount))
    {
      // open web; list; 
      // execute caml query with system account priveliges.
    }
    

    In that case you could check / ensure permissions on a certain list item with the method DoesUserHavePermissions:

    SPListItem item = //...
    if (item.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser, SPBasePermissions.ViewListItems))
    {
      // futher actions if user has permission goes here.
    }
    

    Important to note is that you have to call the overload of the DoesUserHavePermissions with the SPUser argument. 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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to get all versions of list item(s) using a CAML
I am using below CAML query but when I run,it returns all data from
I want to get data from SharePoint List using CAML and filtered by Title
I know a similar question has already been asked, but that retrieves all the
I'm using caml query to retrieve data from sharepoint list. The issue is that
I'm using caml query to select all documents which were modified or added by
In CAML I can query SharePoint Listitems using the Contains-element, but there is no
I want to know how I can connect to the SiteUserInfoList using U2U CAML
I have a scenario where I need to update a list item, but I
I have a list and using caml query I pass the criteria to select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.