Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm using the following code:

protected void TraverseFolder(SPList list, SPFolder folder)
{
    SPQuery qry = new SPQuery() { Folder = folder };
    SPListItemCollection listFolderItems = list.GetItems(qry);
    foreach (SPListItem item in listFolderItems)
    {
        // Do stuff.
    }
}

If the items in the list inherit their permissions from the parent folder then they appear in the collection, if I break inheritance, but keep the same permissions, they don't appear. What's going on?

Stuart.

UPDATE: If I ensure that the user has View Only permissions on another folder (at the same level as the files they can't see) then the files are returned in GetItems. If I take that permission away they don't get returned.

share|improve this question
    
What version of SharePoint are you using? Could you add the tag for it? –  Mike H Jul 5 '10 at 23:48
    
Are you able to include a screenshot of the permissions set for the list, folder, and list items? –  Alex Angas Jul 6 '10 at 23:11
add comment

2 Answers

Upgraded the SharePoint version to Service Pack 2 (12.0.0.6421) and this resolved the issue.

share|improve this answer
add comment

Verify that the permissions really do match up. If you're running in a web part, output SPContext.Current.Web.CurrentUser.LoginName. Double-check this username against the permissions for the list, folder, and list items you are expecting to see.

Alternatively run the code with elevated privileges and see if it works.

share|improve this answer
    
Hi Alex, I've output the login name of the user and it outputs the user as expected. I have an alternate function which runs under elevated privileges and that runs fine, but for performance reasons I need to run under the current user context (explicitly checking permissions takes too long). The user has View Only permission on the files in question, both when inheriting and when broken. –  Stuart Whiteford Jul 14 '10 at 12:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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