获取 SharePoint 列表内容类型 [英] Getting SharePoint List Content Types

查看:56
本文介绍了获取 SharePoint 列表内容类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我们正在使用以下 REST 查询获取所有子站点中的所有列表.

Currently we are getting all lists in all sub sites using below REST query.

'/_api/Web/Webs?$expand=Lists&select=Title,id,ParentWebUrl'

'/_api/Web/Webs?$expand=Lists&select=Title,id,ParentWebUrl'

现在我们还想获取这些列表中使用的所有内容类型.尝试扩展 ContentTypes,但无法使其工作.

now we would like to get the all content types that are used in those lists as well. Tried expanding ContentTypes, but could not get it to work.

任何人都可以帮助获取属于这些列表的内容类型吗?即使在 REST 查询中按内容类型过滤它本身也很好.

Can anyone help to get content types belong to those lists? Even if filtering by content type in the REST query it self is fine.

或者有什么办法可以在列表的搜索结果中做到这一点?

or is there any way to do this in search results of lists?

推荐答案

在到处搜索并没有得到答案之后,我得出的结论是没有这样做的可能性.因此,我使用 SharePoint 搜索服务来获取结果.

After searching everywhere and getting no answers here, I've come to the conclusion there is no possibility of doing this way. So, I've used SharePoint Search services to get my results.

querytext = 'path:"your site collection path" AND (ContentClass:"STS_List_GenericList" OR ContentClass:"STS_List_DocumentLibrary")';

后来我决定将 listID 添加到查询中,因为我从之前的项目搜索中获取 ListID.

Later I decided to add listIDs to the query as I was getting ListIDs from previous Item search.

querytext = '(ListID:"Your list1 ID" OR ListID:"Your list2 ID" OR ListID:"Your listn ID")" AND (ContentClass:"STS_List_GenericList" OR ContentClass:"STS_List_DocumentLibrary")';

现在的问题是,如果列表 ID 超过 75,则查询文本最大字符数超过且未收到任何结果.在搜索了增加最大限制的方法并发现没有办法后,我将列表 ID 分成一组 75 个 ID,并为每个组发送单独的请求,然后将它们组合在一起.你可以在这里阅读它是如何完成的 批量搜索请求

The issue was now if the list IDs exceed more than 75, the querytext max character exceeds and no results was received. After searching a way to increase the maximum limit and finding out there is no way to do it, I divided the list IDs into a set 75 IDs and send separate requests for each set, then combined all together. You can read it how it was done here Batch Search requests

这篇关于获取 SharePoint 列表内容类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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