question

YiruChen-1261 avatar image
0 Votes"
YiruChen-1261 asked CaseyYangMSFT-4714 commented

Set up a Result Source Query to return library names only in SharePoint Online

I need to setup a Result source in SharePoint Online to return library names only.

I have a query transform like this:{searchTerms} (contentclass:STS_List_DocumentLibrary)

but it does not work

Can some one give me a tip on how to get that work

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CaseyYangMSFT-4714 avatar image
0 Votes"
CaseyYangMSFT-4714 answered CaseyYangMSFT-4714 commented

Hi @YiruChen-1261

Whether you use the query in the classic search or modern search?

If you use classic search, per my test, the query works in the classic search.
93494-a.png
Please remember to set the new result source as default after creating it.
93531-b.png
If you use modern search, you could add a PnP search results web part in the modern pages to do search.

1.Edit -> Add a new web part -> PnP-search results.
93532-1.png
2.Configure -> SharePoint search -> Add (contentclass:STS_List_DocumentLibrary) in the Query template section-> Apply.

3.In the Selected properties section, select ‘Path’ and ‘Title’.
93478-2.png



If an Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



a.png (53.6 KiB)
b.png (5.5 KiB)
1.png (21.2 KiB)
2.png (37.4 KiB)
· 13
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I am on a Team Site without O365 group, not on a modern site. The Site Collection settings > Result Source setting pages looked same as in SP2013.

But it returned "Something went wrong" when I tested that query

0 Votes 0 ·

Could you please show me Screenshots of the error and the page of your query? Thank you.

0 Votes 0 ·

unable to upload image. it keeps saying "10 characters needed" or "5 characters needed" what does that mean?

0 Votes 0 ·



[1]: /answers/storage/attachments/94837-capturemsqna.png

0 Votes 0 ·
capturemsqna.png (26.7 KiB)

I have attached the screenshot below. Any idea why it is not working for me?

0 Votes 0 ·



[1]: /answers/storage/attachments/95333-capturemsqna.png

0 Votes 0 ·
capturemsqna.png (26.7 KiB)

Hi @YiruChen-1261

Could you please tap "show details" to show more details, that will help us to know what is going wrong. And thank you for you help.

0 Votes 0 ·
Show more comments