Is it possible to get a list of all content types in a site collection using search api?

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/244634

  •  19-01-2021
  •  | 
  •  

문제

I have a few site collections and I would like to retrieve the content types of each site collection and display them as a list and I was wondering if it can be achieved using search api?

도움이 되었습니까?

해결책

only in a very convulted way... Search is not indexing contenttypes as objects.

You would need to pull all items from the Sitecollection and iterate over them, extracting all contenttypes. Which would not help you at all, since there is no info about them in the result (besides names and ID's)

The proper solution would be to pull them from the REST Service under the URL

/teams/yourSite/_api/Web/ContentTypes

다른 팁

No, it cannot be done. If a content type does not have any data associated with it, the search index will never know it exists.

There are other ways to do it, but Search is not the right tool for this job.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top