Office 365 SharePoint Search for External Users

18/09/2013

If you have a SharePoint online site one of the best features is the ability to invite external users to collaborate with you, or simple just access your data. To invite external users is super simple compared to the traditional on-premise extranet scenario. Investing in SharePoint online as a replacement to on-premise extranets might very well be a business case on its own.
Jesper Osgaard have a great blog post that highlights what external users can do, and what they can’t, you should read it if you are unsure. The only sever limitation on the list for external users is that they per default cannot access the search center. However, luckily that can easily be changed. Here is how.
First step is to enable external access to the search site collection from the central administration.
allowexternalusers

The next step is to invite the users to both your team site and the search center.
Finally, you need to reconfigure the search on your teamsite to use your search center, since the default search results page for team sites (osssearchresults.aspx) does not allow external users to see any results.
configureSearch
With these changes, your external users will be able to search your content.

Search using the REST API for External Users

If you have some custom code, e.g. an APP that uses the search rest API you will notice that it will not work for your external users. The solution to this is to add a sourceid of a result source you created to your REST seach api url like this
http://host/site/_api/search/query?querytext='term'&sourceid='98ecbfc9-5bc7-4a80-b430-cc09f58e3303'
The result source could be as simple as {searchTerms} Path:{Site.URL} or it could be more advanced if you need that. Here is a screenshot of my configuration
resultsource
Now external users will be able to search via the REST API by using your result source.