- 16 Apr 2024
- 5 Minutes to read
- DarkLight
Upload Content To SharePoint
- Updated on 16 Apr 2024
- 5 Minutes to read
- DarkLight
General
This type of action can be used to upload content (such as external files or report documents) to SharePoint.
Properties
This type of action has the following properties:
Name | Description |
---|---|
Content Type | The type of content you want to upload (see below). |
Instance Type | SharePoint Online. Select this option if the instance of SharePoint to upload to is an instance of SharePoint Online. SharePoint Online (Delegated). Select this option if the instance of SharePoint to upload to is an instance of SharePoint Online and you want to authenticate using a specific user account. SharePoint On Premise. Select this option if the instance of SharePoint to upload to is an on-premise instance of SharePoint. |
URL | The URL of the SharePoint instance to upload to. This property is only available if the instance type is set to SharePoint On Premise. |
Username | The username to use to authenticate against SharePoint. This property is only available if the instance type is set to SharePoint On Premise. |
Password | The password to use to authenticate against SharePoint. This property is only available if the instance type is set to SharePoint On Premise. |
Tenant ID | The tenant ID of the SharePoint Online instance to upload content to. This property is only available if the instance type is set to SharePoint Online (see below for more details). |
Client ID | The client ID of the SharePoint Online instance to upload content to. This property is only available if the instance type is set to SharePoint Online (see below for more details). |
Client Secret | The client secret of the SharePoint Online instance to upload content to. This property is only available if the instance type is set to SharePoint Online (see below for more details). |
Site | The site of the SharePoint Online instance to upload content to. This property is only available if the instance type is set to SharePoint Online (see below for more details). |
Document Library | An Expression that evaluates to a string that contains the name of the document library to upload the content to. Leave empty for the default Documents library. This property is only available if the instance type is set to SharePoint Online. |
Remote Path | An Expression that evaluates to a string that contains the remote path (relative to the root path of the SharePoint space) to upload the content to. |
Connecting to SharePoint Online
The following steps have to be performed in your Azure portal:
- Logon to your Azure portal.
- Click App registrations.
- If you haven't yet created an app for Mail & Deploy, click New registration (if you already have an app for Mail & Deploy you can use the Client ID and Client Secret of that app and only need to add additional permissions to the app as you can see below).
- Enter a name for the new app and keep all other options default (no redirect URI is required).
- Remember the Client ID and Tenant ID (these will have to entered in Mail & Deploy).
- Click API permissions
- Make sure that the following MS Graph permissions are granted: Files.ReadWrite.All and Sites.ReadWrite.All (you can alternatively specify more narrowed down permissions to individual sites).
- Click Certificates & secrets
- Click New client secret, create the new secret and remember it (this value needs to be entered in Mail & Deploy).
The Tenant ID, Client ID, and Client Secret need to be entered into the respective Mail & Deploy fields. You can then click the refresh button next to the Sites dropdown and select the site to upload content to.
Connecting to SharePoint Online (Delegated)
The following steps have to be performed in your Azure portal:
- Logon to your Azure portal.
- Click App registrations.
- If you haven't yet created an app for Mail & Deploy, click New registration (if you already have an app for Mail & Deploy you can use the Client ID and Client Secret of that app and only need to add additional permissions to the app as you can see below).
- Enter a name for the new app and keep all other options default.
- Remember the Client ID and Tenant ID (these will have to entered in Mail & Deploy).
- Click API permissions
- Make sure that the following Microsoft Graph delegated permissions are granted: Files.ReadWrite.All, Sites.ReadWrite.All and offline_access.
- Click Certificates & secrets
- Click New client secret, create the new secret and remember it (this value needs to be entered in Mail & Deploy).
- Click Authentication, the Add a platform and select Web. For the Redirect URI, copy the value shown when creating a new Upload Content To Sharepoint Action.
You should now be able to follow these steps:
- Enter the Tenant ID, Client ID, and Client Secret into the respective Mail & Deploy fields.
- Click the Link Sharepoint Account button.
- A new browser tab will open where you must enter credentials of a Sharepoint account and confirm that you want to allow Mail & Deploy to upload content to that account. At the end of that process an authorization code will be displayed.
- Copy the authorization code and paste it back into Mail & Deploy.
- Click Confirm Authorization Code.
You can then click the refresh button next to the Sites dropdown and select the site to upload content to.
Content Types
Uploading a Report Document
You can upload a report document (that you have previously created, for instance with a Create Report Document Action) by setting the Content Type to Report Document. An additional property Content will be available where you can select the report document you want to upload. The Remote Path property must return the relative path on the SharePoint instance including the file name (but excluding the file extension).
Uploading an External File
You can upload an external file to the SharePoint instance by setting the property Content Type to External File. A new property Content Path will be available which is an Expression that evaluates to a string that contains a local or UNC file path to the external file to upload to the SharePoint instance. The Remote Path property must return the relative path on the SharePoint instance including the file name (but excluding the file extension).
Uploading a File Collection
You can upload all files of a File Collection by setting the property Content Type to File Collection. A new property Content will be available where you can select the file collection to upload. The Remote Path property must return the relative path on the SharePoint instance but not include any file name, because the file names of the content of the file collections will be used for the upload.
Uploading a Zipped File Collection
You can upload a ZIP file that contains all files of a File Collection by setting the property Content Type to Zipped File Collection. A new property Content will be available where you can select the file collection to zip and upload. The Remote Path property must return the relative path on the SharePoint instance including the file name of the uploaded ZIP file (but excluding the file extension).