SharePoint Online Search REST API inconsistent results

%3CLINGO-SUB%20id%3D%22lingo-sub-271075%22%20slang%3D%22en-US%22%3ESharePoint%20Online%20Search%20REST%20API%20inconsistent%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-271075%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20executing%20the%20following%20search%20rest%20API%20call%20to%20retrieve%20all%20documents%20libraries%20in%20current%20site%20and%20all%20sub-sites.%20Sites%20are%20'Modern%20Team%20Sites'%20which%20means%20these%20are%20connected%20to%20O365%20Groups.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESearch%20Results%3A%20Case%201%3C%2FP%3E%3CP%3EWhen%20a%20user%20who%20is%20a%20member%20of%20O365%20Group%20lands%20on%20the%20page%2C%20the%20query%20executes%20and%20all%20document%20libraries%20are%20displayed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESearch%20results%3A%20Case%202%3C%2FP%3E%3CP%3EWhen%20a%20user%20who%20isn't%20a%20member%20of%20O365%20Group%20lands%20on%20the%20page%2C%20search%20results%20are%20empty.%20No%20libraries%20are%20retrieved.%20This%20is%20even%20though%20user%20is%20a%20site%20collection%20administrator.%20As%20soon%20as%20we%20add%20the%20user%20to%20'Office%20365%20Group'%2C%20search%20results%20start%20coming%20up%20and%20disappear%20when%20the%20user%20is%20removed%20from%20the%20group.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20behaviour%20is%20also%20manifested%20in%20out-of-the-box%20'HighlightedContent'%20webpart%20if%20we%20configure%20the%20webpart%20to%20show%20document%20libraries%20by%20using%20the%20ContentClass%3DSTS_List_DocumentLibrary%20managed%20property.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehttps%3A%2F%2F%3CTENANT%3E.sharepoint.com%2Fsites%2FModernTeam%2F_api%2Fsearch%2Fquery%3FqueryText%3D'contentclass%3ASTS_List_DocumentLibrary%20Path%3Ahttps%3A%2F%2F%3CTENANT%3E.sharepoint.com%2Fsites%2FModernTeam'%26amp%3BProperties%3D'EnableDynamicGroups%3Atrue%2CEnableMultiGeoSearch%3Atrue%2CClientFunction%3AAllResults'%26amp%3Bselectproperties%3D'Title%2C%20Path%2C%20ParentLink%2C%20WebTemplate%2C%20WebId%2C%20ContentClass%2C%20Description'%26amp%3Btrimduplicates%3Dfalse%3C%2FTENANT%3E%3C%2FTENANT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

We are executing the following search rest API call to retrieve all documents libraries in current site and all sub-sites. Sites are 'Modern Team Sites' which means these are connected to O365 Groups.

 

Search Results: Case 1

When a user who is a member of O365 Group lands on the page, the query executes and all document libraries are displayed.

 

Search results: Case 2

When a user who isn't a member of O365 Group lands on the page, search results are empty. No libraries are retrieved. This is even though user is a site collection administrator. As soon as we add the user to 'Office 365 Group', search results start coming up and disappear when the user is removed from the group.

 

This behaviour is also manifested in out-of-the-box 'HighlightedContent' webpart if we configure the webpart to show document libraries by using the ContentClass=STS_List_DocumentLibrary managed property.

 

https://<tenant>.sharepoint.com/sites/ModernTeam/_api/search/query?queryText='contentclass:STS_List_DocumentLibrary Path:https://<tenant>.sharepoint.com/sites/ModernTeam'&Properties='EnableDynamicGroups:true,EnableMultiGeoSearch:true,ClientFunction:AllResults'&selectproperties='Title, Path, ParentLink, WebTemplate, WebId, ContentClass, Description'&trimduplicates=false

 

0 Replies