Set up Search of OneDrive for Business in Office 365 from SharePoint Server 2013

 

Applies to: Office 365, OneDrive for Business, SharePoint Server 2013

Topic Last Modified: 2016-12-16

Summary: Provide an easy way for users of on-premises SharePoint Server 2013 to search for documents that are in OneDrive for Business in Office 365.

After you install Service Pack 1 for SharePoint Server 2013, when your users click OneDrive or Sites on the navigation bar, you can redirect them to OneDrive for Business in Office 365 for professionals and small businesses.

This article describes how you can then set up an option in the SharePoint Server 2013 enterprise Search Center to return only search results from OneDrive for Business that is in Office 365. This option, called a search vertical, will provide an easy way for a user of on-premises SharePoint Server 2013 to search only the following items in OneDrive for Business in Office 365 for a match to the user's search query:

  • Items that the user has stored in OneDrive for Business in Office 365

  • Items in OneDrive for Business in Office 365 that are shared with the user

  • Items in OneDrive for Business in Office 365 that are shared with everyone

Before you perform the procedures in this article, make sure that you do each of the following:

NoteNote:
Regarding accessibility: SharePoint supports the accessibility features of common browsers to help you administer deployments and access sites. For more information, see Accessibility for SharePoint 2013.

A search vertical filters search results so that only a certain subset of all relevant results is displayed. SharePoint Server 2013 provides four preconfigured search verticals: Everything, People, Conversations, and Videos. You can see the links for these search verticals in the Search Navigation Web Part, which is below the search box on a search-results page, as shown in the following screen capture.

The four default search verticals in an Enterprise Search Center

When a user enters a search query in the search box and then clicks one of the search-vertical links, the Search system returns search results that correspond to that search vertical only. For example, if the user enters Azure in the search box and then selects the Videos search-vertical link, the Search system will return only search results that are videos related to Azure.

In this article, in the SharePoint Server 2013 deployment, you will create a search vertical for OneDrive for Business in Office 365. You will then add a link in the enterprise Search Center for the new search vertical. The link in the enterprise Search Center will look something like this, depending on what you name it.

A OneDrive search vertical and the four default search verticals in an Enterprise Search Center

After that, when users of on-premises SharePoint Server 2013 type queries in the search box in the enterprise Search Center and they click the OneDrive for Business search-vertical link that you created, they will get search results only from OneDrive for Business that is in Office 365.

In this procedure, you create a result source in the SharePoint Server 2013 deployment. This result source is a definition that specifies the URL and path in Office 365 to get search results from, the protocol for getting those results, and several other related settings.

A result source can be created at the Search service application level, the site collection level, or the site level. In this procedure, you create the result source at the Search service application level. This makes the result source available to any query rule that is created at the Search service application level in that Search service application and to any query rule that is created for a site collection or site that is in a web application that consumes the Search service application.

To create the result source
  1. Verify that the user account that you use to perform this procedure is an administrator for the Search service application that you want to configure.

  2. In the SharePoint Server 2013 deployment, in Central Administration, in the Application Management section, click Manage service applications.

  3. Click the Search service application to which you want to add a result source.

  4. On the Search_service_application_name:Search Administration page for the Search service application, in the Quick Launch, click Result Sources.

  5. On the Search_service_application_name:Manage Result Sources page, click New Result Source.

  6. On the Search_service_application_name:Add Result Source page, do the following:

    1. In the Name box, type a name for the new result source—for example, Results from OneDrive in Office 365.

    2. (Optional) In the Description box, type a description of the new result source.

      This description will appear as a tooltip when the pointer rests on the result source on certain configuration pages.

    3. In the Protocol section, select Remote SharePoint.

    4. In the Remote Service URL section, type the address of the root site collection in SharePoint Online that you want to get search results from.

      The address of the root site collection in SharePoint Online is typically of the form https://tenant_name.sharepoint.com, where tenant_name is the name of the Office 365 tenant.

    5. In the Type section, select SharePoint Search Results.

    6. In the Query Transform section, after {searchTerms}, type a space and then type the following:

      path:https:// tenant_name -my.sharepoint.com/personal

      In general, you can use a query transform to narrow search results to a specified subset. In this case, you use a query transform to specify the Path property, which narrows search results to documents that are in OneDrive for Business in Office 365. For more information about query transforms, see the following resources:

    7. In the Credentials Information section, select Default Authentication.

      Your settings on the Search_service_application_name:Add Result Source page then look something like this:

      screen shot of Add Result Source page in SharePoint Server 2013
    8. Click OK to save the new result source.

Each search vertical can have its own search-results page on which results for that vertical are displayed. In the following procedure, you create the search-results page that will display results for the OneDrive for Business search vertical.

To create the search-results page for the OneDrive for Business search vertical
  1. Verify that the user account that you use to perform this procedure is a site collection administrator or site owner for the enterprise Search Center.

  2. In the SharePoint Server 2013 deployment, browse to the enterprise Search Center.

    The URL of the enterprise Search Center is typically of the form http://host_name/sites/Search_Center_name.

  3. Go to Settings > Site Contents > Pages.

    This Pages page contains a list of all of the search-results pages for the enterprise Search Center.

  4. From the Pages page, add a new search-results page by doing the following:

    1. On the ribbon, click the Files tab.

    2. Click New Document, and then click Page.

      screen shot of ribbon on Search Center>Settings>Site Contents>Pages page
  5. On the Create Page page, do the following:

    1. In the Title box, enter a title for the new search-results page, such as OneDriveResults.

    2. (Optional) In the Description box, enter a description for the new page.

    3. In the URL box, enter the portion of the URL that you want to use to identify the page, such as OneDriveResults.

    4. In the Page Layout section, ensure that (Welcome Page) Search Results is selected.

      This specifies how the new search-results page will be displayed.

      Your settings on the Create Page page then look something like this:

      screen shot of Create Search Results page
    5. Click Create.

    6. On the page that contains a list of all of the search-results pages for the enterprise Search Center, do the following:

      1. Select the icon next to the name of the search-results page (such as OneDriveResults) that you just created.

        This selects that row in the list of search-results pages.

      2. On the Files tab, in the Open & Check Out section, select Check In.

      3. In the Check in dialog box, do the following:

        1. In the Version field, select 1.0 Major Version (publish).

        2. In the Retain Check Out field, select No.

        3. (Optional) In the Comments field, enter comments as appropriate for your configuration.

        4. Click OK.

          This checks in and publishes the page.

In this procedure, you configure the Search Results Web Part on the search-results page that you created in the previous procedure in this article (Step 2). You configure the Search Results Web Part to display search results from OneDrive for Business that is in Office 365.

To configure the Search Results Web Part to display search results from OneDrive for Business that is in Office 365
  1. Verify that the user account that you use to perform this procedure is a site collection administrator or site owner for the enterprise Search Center.

  2. Go to the page that has a list of all of the search-results pages for the enterprise Search Center.

    You accessed this page in the previous procedure in this article (Step 2). To reach it again, browse to the enterprise Search Center, and then go to Settings > Site Contents > Pages. The URL of the page might resemble http://host_name/sites/Search_Center_name/Pages/Forms/AllItems.aspx.

  3. Click the name of the search-results page (such as OneDriveResults) that you created, checked in, and published in the previous procedure in this article (Step 2).

    Clicking the name of the search-results page will take you to that page.

    NoteNote:
    On the search-results page, you might see the message Sorry, something went wrong, or the message Nothing here matches your search. These are default messages that can be displayed on the search-results page when a user search fails. These messages do not apply to the configuration that you are currently doing.
  4. Go to Settings > Edit page.

  5. On the ribbon, click the PAGE tab.

  6. On the PAGE tab, in the Search Results Web Part, move the pointer to the right until you see the down arrow, and then click the arrow.

    The Search Results Web Part menu appears.

  7. On the Search Results Web Part menu, choose Edit Web Part.

    screen shot of Search Results Web Part menu

    The Search Results Web Part tool pane then appears at the top right of the page that you are editing.

  8. In the Search Results Web Part tool pane, click Change query.

    screen shot of Change Query button in Search Results Web Part tool pane
  9. In the Build Your Query dialog box, do the following:

    1. In the Select a query section, on the drop-down menu, select the result source that you created in the first procedure of this article, such as Results from OneDrive in Office 365.

      This causes search results from OneDrive for Business in Office 365 to appear in the Search Results Web Part on the OneDriveResults search-results page.

    2. Skip the other sections in the dialog box, and then click OK.

  10. On the PAGE tab, in the Edit group, click Check In.

  11. In the Check In dialog box, do the following:

    1. (Optional) Type comments as appropriate for your configuration.

    2. Click Continue.

  12. Do either of the following to publish the page:

    • Click Publish this draft.

    • Do the following:

      1. On the Publish tab, click Publish.

      2. In the Publish dialog box, optionally type comments as appropriate for your configuration, and then click Continue.

In this procedure, you create the link in the SharePoint Server 2013 enterprise Search Center that users will click to get results from OneDrive for Business that is in Office 365. After you create the link, it appears in the Search Navigation Web Part, under the search box next to the links for the other search verticals, such as Everything and People. The links in the Search Navigation Web Part then look something like this, depending on your particular configuration:

A OneDrive search vertical and the four default search verticals in an Enterprise Search Center

To create the link for the OneDrive for Business search vertical
  1. Verify that the user account that you use to perform this procedure is a site collection administrator or site owner for the enterprise Search Center in the SharePoint Server 2013 deployment.

  2. Browse to the enterprise Search Center in the SharePoint Server 2013 deployment.

    The URL of the enterprise Search Center is typically of the form http://host_name/sites/Search_Center_name.

  3. Go to Settings > Site Settings.

  4. On the Site Settings page, in the Search section, click Search Settings.

    screen shot of Search section on Search Center Site Settings page
  5. On the Search Settings page, do the following:

    1. (Optional) In the Enter a Search Center URL section, in the Search Center URL box, type the URL of the enterprise Search Center.

      If you type a URL in this box, after a user performs a search from a search box on another site, the Search system displays a link that the user can click to try the search again from the enterprise Search Center.

    2. In the Which search results page should queries be sent to? section, select Use the same results page as my parent.

    3. In the Configure Search Navigation section, select Add Link.

    4. In the Navigation Link dialog box, do the following:

      screen shot of Navigation Link Dialog Box
      1. In the Title box, type the text (such as MyOneDrive) that you want to use for the search-vertical link in the enterprise Search Center that will take users to the search-results page that you created in the second procedure (Step 2) in this article.

      2. In the URL box, do one of the following:

        • Type the relative path to the search-results page that you created in the previous procedure, such as /sites/Search_Center_name/Pages/onedriveresults.aspx.

        • Click Browse.

        • In the list of search-results pages, click the name of the search-results page for the new search vertical, and then click Insert.

      3. Select the Open link in new window check box if you want the search-results page for OneDrive for Business to open in a new window when users click the link for that search vertical.

      4. (Optional) In the Description box, type a description for the new link.

      5. (Optional) In the Audience box, type the name of a global audience, a SharePoint group, a distribution group, or a security group to which access to the new search-results page will be limited.

        All Site users is the default value if you do not type anything in the Audience box. The value All site users allows access to all users who can access the Search Center site. For more information, see "To grant access to the SharePoint Search Center" in Create a Search Center site in SharePoint Server 2013.

      6. If you typed a value in the Audience box, then next to that box, click the Check Names icon to make sure that SharePoint Server 2013 recognizes the audience that you typed.

      7. Click OK.

    5. In the Configure Search Navigation section, click the name of the new link, such as MyOneDrive, and then click Move Up or Move Down as appropriate to position the new link where you want it to appear in the group of search-vertical links.

    6. Click OK.

Federated users should now be able to use the new MyOneDrive search vertical to get results from OneDrive for Business that is in Office 365. Searches that federated users perform in the new search vertical should return the following items from OneDrive for Business that is in Office 365 that match the search query:

  • Items that the user has stored in OneDrive for Business in Office 365

  • Items in OneDrive for Business in Office 365 that are shared with the user

  • Items in OneDrive for Business in Office 365 that are shared with everyone

A federated user is one who has an account in the on-premises Active Directory Domain Services (AD DS) Domain Users group that has been synchronized with Azure Active Directory by using the Azure Active Directory Sync tool (DirSync). The account has group memberships and permissions for resources in the SharePoint Server 2013 deployment and in Office 365, and can access resources in both environments by authenticating with the federation identity provider, such as Active Directory Federation Services (AD FS) 2.0.

To validate your configuration for displaying search results from OneDrive for Business that is in Office 365, you can log on to SharePoint Server 2013 as a federated user and try some searches from the OneDrive for Business search vertical in the enterprise Search Center. Use the following procedure to validate your configuration in this way.

To test your configuration for displaying search results from OneDrive for Business that is in Office 365
  1. Log on to the SharePoint Server 2013 deployment as a federated user who has been activated in Office 365, and who has permission to view the root site collection in SharePoint Online in Office 365.

  2. Browse to the enterprise Search Center in the SharePoint Server 2013 deployment.

    The URL of the enterprise Search Center might resemble http://host_name/sites/Search_Center_name.

  3. In the enterprise Search Center, do the following:

    1. In the search box, type a test search query, such as the name of your company.

      Make sure that it’s a query that should yield some search results from OneDrive for Business that is in Office 365.

    2. Press Enter or click the search icon, and then wait for initial search results to be displayed.

    3. After the initial search results are displayed, click the link for the search vertical for OneDrive for Business that you created earlier in this article.

    4. On the search-results page, confirm that you see results from OneDrive for Business that is in Office 365.

    5. If you do not see results from OneDrive for Business in Office 365 on the search-results page, do the following:

      1. Verify each of the following:

        1. You configured the hybrid SharePoint environment as described in the following articles, and in the following order:

          1. Configure hybrid federated search from SharePoint Server 2013 to SharePoint Online - roadmap

          2. Configure server-to-server authentication from SharePoint Server 2013 to SharePoint Online

        2. You completed the procedures described in How to redirect users to Office 365 for OneDrive for Business.

        3. You completed the previous procedures described in this article.

      2. Correct any errors or omissions, and try a search again.

      3. If you still do not see search results from OneDrive for Business that is in Office 365, check the SharePoint Unified Logging Service (ULS) logs, also called SharePoint trace logs.

        For more information, see Overview of Unified Logging System (ULS) Logging.

Show: