OneDrive | Yext Hitchhikers Platform

Overview

Use the OneDrive source to pull OneDrive files and data into Yext Content.

The OneDrive source uses the Microsoft APIs for the following operations:

  • Fetch Drive Items: pull all child items (files, folder data, etc.) from the specified drive.
  • Fetch Items: pull child items from within an item (e.g., Folder) in OneDrive.

Authentication

Select the Microsoft account to fetch your data from. This account must exist in Yext as a Linked Account under the Microsoft Built-in Provider.

  1. You can add a linked account directly from the Connector Settings page (in the dropdown to select a Linked Account), or from Content > Configuration > Linked Accounts > Microsoft.

  2. Click Add Linked Account. You’ll see the following two scopes to add:

    • Files.Read.All: Grants Yext permission to read all files on behalf of the authenticated user.
    • Sites.Read.All: Grants Yext permission to read documents and list items in all Site Collections on behalf of the authenticated user.
    • At least one of the two scopes is required for the Fetch Items (From a Root Drive) and Fetch Items operations. Sites.Read.All is required for the Fetch Pages operation.
  3. Click Link and continue through the Microsoft OAuth flow. Once the authentication setup is complete, you’ll need to provide a specific name and ID for your Linked Account. You may want to use the email you linked as the Name, with the email preceded by microsoft. for the Linked Account ID. For example, you might name your Linked Account youremail@gmail.com, with the ID microsoft.youremail@gmail.com.

Fetch Drive Items

Fetch all the child items (e.g. files, folders) from within the specified Drive.

Authentication

Link your Microsoft account which has access to the desired items. When choosing a scope, you must include Files.Read.All and/or Sites.Read.All

Drive ID

Specify the ID of the Drive to fetch items from. See below for instructions on how to find your Drive ID.

Data

In order to get all child items and the associated permissions for each item in your Drive, Yext will make the following requests:

https://graph.microsoft.com/v1.0/drives/[driveId]/root/children

This request fetches all the children in your Drive. See the DriveItem resource type documentation from Microsoft for more details.

https://graph.microsoft.com/v1.0/drives/[driveId]/items/[itemId]/permissions

This request fetches all the permissions associated with each child item. See the Permissions endpoint documentation from Microsoft for more details.

Fetch Items

Fetch all the child items (e.g. files) from within the specified parent item (e.g folder) in your Drive.

Authentication

Link your Microsoft account which has access to the desired items. When choosing a scope, you must include Files.Read.All and/or Sites.Read.All

Drive ID

Specify the ID of the Drive to fetch items from. See below for instructions on how to find your Drive ID.

Item ID

Specify the ID of the top level (parent) item from which you want to fetch child items. This will likely be the ID of a folder in your drive. See below for instructions on how to find your Item ID.

Data

In order to get all Child items and the associated permissions for each item in your Drive, Yext will make the following requests:

https://graph.microsoft.com/v1.0/drives/[driveId]/items/[itemId]/children

This request fetches all the children in your Drive. See the DriveItem resource type documentation from Microsoft for more details.

https://graph.microsoft.com/v1.0/drives/[driveId]/items/[itemId]/permissions

This request fetches all the permissions associated with each child item. See the Permissions endpoint documentation from Microsoft for more details.

Pagination

The Connector will paginate through the API response according to Microsoft’s pagination support, as detailed in Microsoft’s pagination documentation . The Connector will return the default page size for the given API.

Retrieve Drive IDs and Item IDs

These IDs are only accessible via the API. There are a few ways to retrieve the appropriate IDs.

In order to make API requests, you can use the Microsoft developer playground to make sample API calls.

  1. Navigate to https://developer.microsoft.com/en-us/graph/graph-explorer
  2. Add the permission “Sites.Read.All”
  3. Log into your Microsoft Account (in the upper right hand corner)

Drive ID

You can use one of the following options to retrieve a Drive ID:

To see a list of all the drive YOU own, use the following API Call:

  • GET https://graph.microsoft.com/v1.0/me/drives

To get a list of all Drives in a Site, make the following API Call:

  • GET https://graph.microsoft.com/v1.0/sites/{siteId}/drives

The API will response will include a value for “id”.

Item ID

You can use one of the following options to the ID of a specific Item (e.g., Folder):

To get a list of all Items in YOUR Drive, make the following API Call:

  • GET https://graph.microsoft.com/v1.0/me/drive/root/children (ROOT Drive)
  • GET https://graph.microsoft.com/v1.0/me/drive/{drive-id}/children

To search for an Item in a given drive using a keyword, use the following API Call:

  • GET https://graph.microsoft.com/v1.0/drives/{drive-id}/search(q='{keyword}')

To get all the Children of in the Root for any given Drive, use the following API Call:

  • GET https://graph.microsoft.com/v1.0/drives/{drive-id}/root/children

To get all the children of an Item (to get more item IDs for nested Items:

  • GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/children

The API will response will include a value for “id”