Create SharePoint Feed
Create SharePoint document library feed to ingest files.
Graphlit supports ingesting files from SharePoint document libraries.
The createFeed
mutation enables the creation of a feed by accepting the feed name
, type
and site
feed parameters and it returns essential details, including the ID, name, state, and type of the newly generated feed.
Depending on the specified type
parameter, Graphlit requires the specific feed parameters including the SharePoint authenticationType
, accountName
, libraryId
and tenantId
.
Mutation:
Variables:
Response:
SharePoint Libraries
You can enumerate the available libraries, across your SharePoint sites, with the sharePointLibraries
query.
This accepts the same authentication properties as the createFeed
mutation above, described in the site/sharePoint
field.
Query:
Variables:
Response:
Authentication
The SharePoint feed supports APPLICATION
and USER
authentication, selected by the authenticationType
field.
Application Authentication
When using Application authentication, the owner of the SharePoint document library must consent to the Graphlit Platform application registered in Azure Active Directory before calling thecreateFeed
mutation.
By executing the sharePointConsentUri
query, and passing the Azure AD tenantId
variable, you will receive a URL which can be visited to provide admin consent to the Graphlit Platform application.
The consent page asks for read-only permissions to SharePoint sites and files, which are required for the recurrent feed ingestion from SharePoint document libraries.
Mutation
Variables
Response
User Authentication
When using User authentication, you will need to authenticate your end-user via OAuth 2.0 and receive a refresh token for the end-user. Graphlit will use the refresh token to authenticate and enumerate files on the SharePoint document library on your user's behalf.
Variables
To get a refresh token, you need to make a POST request to the /token endpoint.
Details on registering an Azure AD application, which provides the client_id
and client_secret
are found below.
In the request body, provide the code that you received in the previous authorize call, the client ID, and the client secret.
The response includes an access token and a refresh token, which can be provided to the createFeed
mutation for accessing end-user's files in the Graphlit Platform services.
Optional: Azure AD Application Registration
If using user authentication, and you have not yet registered an Azure AD application, here are the steps:
Go to Azure Active Directory in the Azure portal: Azure portal
In the left-hand navigation pane, select "App registrations" and then select "New registration".
When the "Register an application page" appears, enter your application's registration information:
Name: Enter a meaningful application name that will be displayed to users of the app
Supported account types: Select which accounts you would like your application to support
Redirect URI (optional): Set to the appropriate URI where authentication responses can be sent and received by your app
After you've completed registration, Azure AD will assign your app a unique client identifier (the Application (client) ID), a crucial value that you use in your app configuration.
Set permissions in Azure AD
The app requires delegated permissions to access resources in the Microsoft Graph API. These permissions must be granted by the user or an administrator at sign-in.
In your app registration page in the Azure portal, find the "API permissions" section and select "Add a permission".
In the "Request API permissions" page, select "Microsoft Graph".
Choose "Delegated permissions", then in the "Select permissions" section, add the following permissions:
Files.Read.All
Sites.Read.All
Click on "Add permissions" to save your changes.
Obtain User Consent
Before your application can get tokens from the Microsoft identity platform, users or administrators need to grant permissions to the application, a process known as consent. To request consent, construct a request URL that directs the user to the /authorize endpoint. You can add this request to a sign-in button in your application.
Last updated