So I’ve been playing around with Office 365 and one of my objectives at the moment is to set it up for external access for things like extranets etc.

One method of adding external users (whilst retaining the ability to have multi-factor authentication) is to add them using the Users list in the “Office 365 Admin Center” (Centre to me!).

However, this results in the problem that the user shows up in SharePoint Online searches and Delve which we usually don’t want to happen for external users.

So my answer to this is to exclude the users using a Search Query Rule, and exclude them based on a user profile field, in this case I have set each external user account’s Department field to “None” (via SharePoint Online User Profiles).

  1. Go to the O365 Admin Centre for your tenancy, then navigate to the SharePoint admin centre (or go direct if you have a shortcut somewhere)
  2. Click on “search” from the list to the left hand side O365SearchCapture1
  3. Click on “Manage Query Rules” O365SearchCapture2
  4. Click on “Select a Result Source …” and select “Local People Results (System)”O365SearchCapture3O365SearchCapture4
  5. Click on “New Query Rule”O365SearchCapture5
  6. Type in the “Rule name”, in my case I types Exclude External User (see image below)
  7. Click on “Context” to expand that section, then ensure “One of these sources” is selected and it reads “Local People Results” below it (see image below)
  8. In the Query Conditions section click “Remove Condition” so that the event fires for all keywords and will capture partial names
  9. Click “Change ranked results by changing the query” (see image below)
  10. Enter something like {searchTerms} -Department:None into the “Query text” box if you want to exclude where Department = None.  You can test by changing {searchTerms} to your keyword, e.g. Joe Bloggs -Department:None.  Remember to put it back to the text in bold above  O365SearchCapture6
  11. Save
  12. I had to add the new rule to a new group for it to work so do this too by clicking on the check box to the left of the new rule, then click on “Order Selected Rules”
  13. In the pop up window enter a new group name and click OK
  14. The rule should take effect within a few minutes so test using a SharePoint Online search box.

As for Delve I am still working on that, it is meant to take it’s data from the SharePoint index but I’ll need to wait for Delve to update so that I can test.  There also appears to be two fields in the user profile related to Delve and Office Graph which I am also testing and again I have to wait until Delve updates before I know if changing those fields has any effect.