SharePoint:如何通过Web服务方法获取列表静态名称

发布于 2024-08-11 04:24:13 字数 203 浏览 2 评论 0原文

当我使用某个功能在共享点中创建列表时,我指定 staticName,该静态名称将成为列表 URL 的一部分。

当我查询列表并想要获取名称时 - 现在所有 sharepoint Web 服务发回的都是 ID,例如:Name=\"{1836D8BB-77D3-4266-AA09-1ABB68E5C672}\"

我怎样才能获得又是静态名称吗?

谢谢

When I create a list in sharepoint using a feature I specify the staticName which becomes part of the URL to the list.

When I query the list, and want to get the name - now all the sharepoint web service sends back is the ID, for example: Name=\"{1836D8BB-77D3-4266-AA09-1ABB68E5C672}\"

How can I get the static name again?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卸妝后依然美 2024-08-18 04:24:13

Lists.asmx Web 服务中的 GetList 方法将返回一个名为 DefaultViewUrl 的字段。它看起来像这样:

DefaultViewUrl="/Site_Name/Lists/List_Name/AllItems.aspx" 

下面的代码将为您提供静态名称:

String pattern = ".*/(?<listStaticName>.+)/[^\\.]+\\.aspx";
Regex regex = new Regex(pattern);
MatchCollection matches = regex.Matches(DefaultViewUrl);
String listStaticName = matches[0].Groups["listStaticName"].ToString();

远不是一个优雅的解决方案,但它会起作用。

编辑:实际上,SPList.RootFolder.Name 应该为您提供与文档库相同的结果。

The GetList method in the Lists.asmx web-service will return a field called DefaultViewUrl. It'll look like this :

DefaultViewUrl="/Site_Name/Lists/List_Name/AllItems.aspx" 

The following code would then give you the static name :

String pattern = ".*/(?<listStaticName>.+)/[^\\.]+\\.aspx";
Regex regex = new Regex(pattern);
MatchCollection matches = regex.Matches(DefaultViewUrl);
String listStaticName = matches[0].Groups["listStaticName"].ToString();

Far from an elegant solution, but it will work.

EDIT : Actually, the SPList.RootFolder.Name should give you the same result for a document library.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文