使用GUID调用时,WSS GetListItems不会返回没有继承权限的文件夹 [英] WSS GetListItems Not Returning Folders without Inherited Permissions when Calling with GUID

查看:100
本文介绍了使用GUID调用时,WSS GetListItems不会返回没有继承权限的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WSS 3.0列表服务

WSS 3.0 List Service

我正在使用以下CAML查询在图片库(名为图片)上运行 GetListItems():

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>

此查询正确返回了Uploads文件夹中的所有文件和文件夹.

This query correctly returns all files and folders in the Uploads folder.

但是,如果我导航到Uploads文件夹并在Uploads文件夹中选择 Edit Permissions ,然后选择 Actions > Edit Permissions ,然后单击在确认框中确定,此查询不再起作用.

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.

我尝试过的其他方法:

  • 删除QueryOptions中的所有标记:这仍然不会返回Uploads文件夹或其下的任何文件或文件夹
  • 将权限直接添加到我的用户帐户的文件夹中:这无济于事
  • 搜索具有类似问题或某种解决方案的东西:无济于事

其他信息:

  • 从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.

因此,在进行了更多的实验之后,找到了一个解决方案,尽管没有得到很好的解释或记录.问题与 GetListItems 函数的调用方式有关,这是无法正常工作的代码:

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);

对于上述情况,此操作无法正常工作,但是,它适用于所有其他文件夹和文件.解决方案是向 GetListItems 发送列表名称"Pictures",而不是列表GUID,如下所示:

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);

更新
此外,MSDN 文档建议改为使用GUID. Lists.GetListItem方法时列表名称的名称:

Update
Furthermore, MSDN documentation recommends the usage of GUID instead of the list name when using the Lists.GetListItem method:

listName :包含以下任意一个的字符串 显示名称或GUID 列表.建议您使用 GUID,必须将其包围 大括号 ({}).查询时 UserInfo表,该字符串包含 "UserInfo".

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?

推荐答案

因此,在进行了更多实验之后,找到了一个解决方案,尽管没有得到很好的解释或记录.问题与 GetListItems 函数的调用方式有关,这是无法正常工作的代码:

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);

对于上述情况,此操作无法正常工作,但是,它适用于所有其他文件夹和文件.解决方案是向 GetListItems 发送列表名称"Pictures",而不是列表GUID,如下所示:

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);

这篇关于使用GUID调用时,WSS GetListItems不会返回没有继承权限的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆