WSS 3.0 List Service
I am running GetListItems() on a Picture Library (name Pictures) using the follow CAML query:
<Query>
</Query>
<ViewFields>
<FieldRef Name="EncodedAbsUrl"/>
<FieldRef Name="Title"/>
<FieldRef Name="ContentType"/>
</ViewFields>
<QueryOptions>
<Folder>Pictures\Uploads</Folder>
<ViewAttributes Scope="RecursiveAll"/>
</QueryOptions>
This query correctly returns all files and folders in the Uploads folder.
However, if I navigate to the Uploads folder and select Edit Permissions on the Uploads folder then select Actions > Edit Permissions and then click OK on the confirmation box this query no longer works.
I do not believe this is related to permissions, because I did not modify the permissions at all I just “cop[ied] permissions from parent, and then stop[ped] inheriting permissions,” by selecting Edit Permissions. In addition, I do not receive an error message when running this query, I just get an empty result set.
Other things I have tried:
- Removing all tags in QueryOptions: This still does not return the Uploads folder or any file or folder under it
- Adding permissions directly to the folder for my user account: This does not help
- Searching for something with a similar problem or some sort of solution: No avail
Other information:
- Calling this from C# Win Form App
Does anyone know how to fix or work around this? If more detail or clarification is necessary please let me know.
So after some more experimenting, a solution was found, though not well explained or documented. The problem was related to how the GetListItems function was being called, here is the code that was not working correctly:
System.Xml.XmlNode ndListView = listProxy.GetListAndView("Pictures", "");
string strListID = ndListView.ChildNodes[0].Attributes["Name"].Value;
XmlNode returnNode = listProxy.GetListItems(strListID, strViewID, queryNode, viewNode, _maxFolders, optionNode, null);
This was not working as expected for the situation explained above, however, it was working for every other folder and file. The solution was to send GetListItems the list name, "Pictures" instead of the list GUID, like so:
XmlNode returnNode = listProxy.GetListItems("Pictures", strViewID, queryNode, viewNode, _maxFolders, optionNode, null);
Update
Furthermore, MSDN documentation recommends the usage of GUID instead of the list name when using the Lists.GetListItem method:
listName: A string that contains either the display name or the GUID for the list. It is recommended that you use the GUID, which must be surrounded by curly braces ({}). When querying the UserInfo table, the string contains "UserInfo".
I do not know why this code works and the original does not. Although my problem has been solved, does anyone have a clue why my original code does not work (only for the situation explained above) and the modified code work?