1

My requirement is to retrieve list items using search API instead of rest API. I have used a content type for the list but I am unable to retrieve the items in the List.This is due to the incorrect I think.

url:/sites/mysite/_api/search/query?querytext='(contenttype:Company)'&sourceid='D94AD30B-63E6-4B54-A3D2-258A590E3EB6'&selectproperties='Title,CompanyDescriptionOWSMTXT'

I used the above url and unable to get the first 30 items.Please help! thanks in advance

2

It is better to use the ContentTypeId: instead of the ContentType Name like this:

https://site.sharepoint.com/_api/search/query?querytext='ContentTypeId:0x01005FC5182DF0BF554287F15C4D8B798E6*'

if the content type is used in other lists, then it is better to add the path of the targeted list and your query will look like this:

https://site.sharepoint.com/_api/search/query?querytext='ContentTypeId:0x01005FC5182DF0BF554287F15C4D8B798E6*+Path:https://paratekpharma.sharepoint.com/site/Lists/listname'

You can get the ID of your content type using the following steps:

for example: ManageContentType.aspx?ctype=0x01005FC5182DF0BF554287F15C4D8B798E60

Note: I removed the last 0 from the content type and added a * instead

  • what can we do for cross domain?? – user79174 Oct 16 '18 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.