Connectors / Service / SharePoint

Artisan IMG > SharePoint (sharepoint)

SharePoint

SharePoint is a web-based collaborative platform that integrates with Microsoft Office

Overview

SharePoint is a web-based collaborative platform that integrates with Microsoft Office. SharePoint is primarily sold as a document management and storage system, but the product is highly configurable, and usage varies substantially among organizations.

API INFO: The Base URL used for the SharePoint connector is https://[TENANT-NAME].sharepoint.com/_api. More information can be found on their main API documentation (v2.0) site.

Authentication

Version 3.0 +

Within the workflow builder, highlight the SharePoint connector.

In the SharePoint connector properties panel to the right of the builder, click on the Authenticate tab and the 'New authentication' button.

sharepoint-auth

This will result in a Tray.io authentication pop-up modal. The first page will ask you to name your authentication and select the type of authentication you wish to create ('Personal' or 'Organisational').

The next page asks you for your 'Tenant name', 'Tenant ID', 'Client ID', and 'Client secret' credentials.

sharepoint-auth-popup

The 'Tenant name' is your organization's domain that was created when you signed up with Microsoft SharePoint.

The 'Tenant ID' can be found in the Azure Active Directory on the Overview page.

sharepoint-auth-step-1

In order to get the remaining credentials, you would need to register your app and give it the required permissions.

To learn more about registering your app refer to the Register SharePoint Add-ins document.

To register your app, go to: https://[TENANT-NAME].sharepoint.com/_layouts/15/AppRegNew.aspx.

sharepoint-auth-step-2

Fill in the required fields as explained below:

Client Id: The 'Client Id' can be generated using the 'Generate' button beside the 'Client Id' field.

Client secret: You can generate the 'Client secret' using the 'Generate' button beside the 'Client Secret' field. The newly generated client secret should look similar to this: xvVpG0AgVIJfch6ldu4dLUlcZyysmGqBRbpFDu6AfJw=.

Title: A user-friendly title for the application, for example, Contoso photo printing add-in. Users are prompted to grant or deny the permissions the add-in is requesting. This title appears as the name of the add-in on the consent prompt.

App domain: The add-in domain must match the URL bindings you use for your web application. Do not include protocol https: or / characters in this value.

Redirect URI: The redirect URI needs to be https://auth.tray.io/oauth2/token.

Once you have added all the information, click on the 'Create button'.

Now the next step is to grant permissions to the newly created app by going to: https://[TENANT-NAME]-admin.sharepoint.com/_layouts/15/appinv.aspx

IMPORTANT!: The link that you have may not contain the 'admin' keyword as you can see in the above link. The link won't work without the admin keyword So, do not forget to add the admin keyword after your tenant name.

Once you are redirected using the above link, to add the permissions, provide the 'App Id' that you have just created.

Once done, click on the 'Lookup' button. It will autoload all the information for the below fields except the permissions.

Add the permissions based on your need. To learn about the permissions refer to the Granting access using SharePoint document.

sharepoint-auth-step-3

Once you have added these fields to your Tray.io authentication pop-up window, click the 'Create authentication' button.

Go back to your settings authentication field (within the workflow builder properties panel), and select the recently added authentication from the dropdown options now available.

Your connector authentication setup should now be complete.

Version 2.3 and earlier

Authentication for the Sharepoint connector version 2.3 and earlier is done through a simple OAuth2 login process.

After clicking Add authentication, you will be redirected to Sharepoint's login screen.

Create authentication

Available Operations

The examples below show one or two of the available connector operations in use.

Please see the Full Operations Reference at the end of this page for details on all available operations for this connector.

Notes on using SharePoint

Upload File

The 'Upload file' operation can be used to create new files or update existing files.

To upload a file, the operation needs the following information.

  • Conflict behavior: The first input tells the workflow how to deal with conflicts. Conflicts happen when a file with a certain name already exists. The default behavior is to Fail the operation to avoid overwriting the existing file.

    If you do not want to overwrite the file but still want to upload the file, you can select the Rename option from the drop-down. This option will rename the file in the destination, usually by appending a number to the filename.

    The last option is to overwrite the file. To overwrite the file, select the Replace option from the drop-down.

  • Location: The second is the location of the file. This can anything from the provided options. Such as in the root directory of a site drive, or relative to an item in a site drive, such as a folder. Select appropriate value based on your situation.

  • File: The third input is the file itself. The input value for this field is mostly a jsonpath for the file from the previous connector or helpers such as File helpers.

  • File path: The last input is a file path. This path will be set relative to the location, so if you choose a site drive as the location, this file path will be relative to that.

sharepoint-notonops-upload-file

Download file

The download file operation takes in the location of a drive item. This can be a file in either a OneDrive, or a Sharepoint site drive.

sharepoint-notonops-download-file

Using the Raw HTTP Request ('Universal Operation')

As of version 3.0, you can effectively create your own operations.

This is a very powerful feature which you can put to use when there is an endpoint in SharePoint which is not used by any of our operations.

To use this you will first of all need to research the endpoint in the SharePoint API documentation, to find the exact format that SharePoint will be expecting the endpoint to be passed in.

Note that you will only need to add the suffix to the endpoint, as the base URL will be automatically set (the base URL is picked up from the value you entered when you created your authentication).

The base URL for SharePoint is: `https://[TENANT-NAME].sharepoint.com/_api`

IMPORTANT!: The base URL for SharePoint v2.3 is https://graph.microsoft.com/v1.0 as we migrated from the Microsoft Graph API to SharePoint API effectivley from version 3.0

For example, say that the 'List sites' operation did not exist in our SharePoint connector, and you wanted to use this endpoint. You would use the SharePoint API docs to find the relevant endpoint - which in this case is a GET request called: /v2.0/sites.

More details about this endpoint can be found here.

sharepoint-get-url

There is also the option to include a query parameter, should you wish to do so. So if you know what your method, endpoint and details of your query parameters are, you can get the site information with the following settings:

Method: GET

Endpoint: /v2.0/sites

Query Parameter: Key: search Value: Communication site

Final outcome being: https://[TENANT-NAME].sharepoint.com/_api/v2.0/sites?search=Communication site

sharepoint-raw-http

All Operations

Latest version:

3.2

Create folder

Create a new folder in a Drive with a specified parent item or path.

Create item

Creates an item in a list.

Delete drive item

Delete a DriveItem by using its ID or path. Note that deleting items using this method will move the items to the recycle bin instead of permanently deleting the item.

Download file

Download a file.

Get item

Get an item in OneDrive or SharePoint.

Get list item

Return information about an item.

Get site

Return a site.

List children

Return a collection of files and folders in the children relationship of a DriveItem.

List list items

Return the items of a list.

List list items fields DDL

List site drives

Return a list of drives for a site.

List site drives DDL

List site lists

Return a list of lists for a site.

List site lists DDL

List sites

Return a list of sites.

List sites DDL

Move item

Move an item to a different folder.

Raw HTTP request (advanced)

Perform a raw HTTP request with some pre-configuration and processing by the connector, such as authentication.

Update drive item properties

Update a specific drive item by ID.

Upload file

Upload a file to a drive.