Microsoft Office 365 Using REST API
Transferring Content to SharePoint Online Shared Document Library
PlatformType in Connection:Â office365
URI Pattern in Connection: https://company.sharepoint.com/[SiteNameWhereLibraryExists]/
Target/Path in Job:Connection Config: /[LibraryName]
This configuration will transfer data to the destination at the library specified. Connection will take it down to Site specific level.Â
Path in the 'Job:Connection:Target' should be the Document Library.
Use the Library name found in the URI (you do not have to escape/encode spaces, just enter a space if that exists in the library name).
Â
If a path is not specified, files will transfer to the default library for the site specified.
Creating a Connection
You will need to add the relevant connection information into the GET request. The following GET will return a Microsoft login link. Use the link to complete logging into the account and to grant DryvIQ access to the account.Â
GET {{url}}v1/connections/platforms/office365-graph/new?domain={{YOUR URL}}&name={{YOUR CONNECTION NAME}}&client_id={{YOUR CLIENT ID}}&client_secret={{YOUR CLIENT SECRET}}
Creating a Job Using Impersonation
As a Office 365 administrator, you can impersonate a user using the path that relates to their content. Then, use their information in the impersonate_as block. (See Impersonation for more information on how to impersonate users.)
Impersonation with Office 365 Connection
{
"name":"Basic job with impersonation",
"kind": "transfer",
"transfer": {
"audit_level": "trace",
"transfer_type": "copy",
"source": {
"connection": { "id": "{{nfs_source_connectionID}}" },
"target": {
"path": "/sourcePath"
}
},
"destination": {
"connection": { "id": "{{O365_destination_connectionID}}" },
"impersonate_as": {
"id": "00",
"name": "Joe Smith",
"email": "jsmith@company.onmicrosoft.com"
},
"target": {
"path": "/destinationPath"
}
},
"simulation_mode": false
},
"schedule": {
"mode": "manual"
},
"stop_policy": {
"on_success": 5,
"on_failure": 5,
"on_execute": 25
},
"category": {
"name": "category name"
}
}
Creating a Job with Tenant Level Connection
When creating a job that is mapped to the default site collection of the tenant the value "Default" must be used even though the URL does not have a ../sites/{site_name} representation. When setting the root site collection the name should not be prefixed with "sites/".
Impersonation with Office 365 Connection
{
"name":"Basic job with tenant level connection",
"kind": "transfer",
"transfer": {
"audit_level": "trace",
"transfer_type": "copy",
"source": {
"connection": { "id": "{{nfs_source_connectionID}}" },
"target": {
"item": {
"parent": {
"parent": {
"root": true,
"name": "{{site_collection_name}}"
},
"name": "{{site_name}}"
},
"name": "{{library_name}}"
}
}
},
"destination": {
"connection": { "id": "{{O365_destination_connectionID}}" },
"impersonate_as": {
"id": "00",
"name": "Joe Smith",
"email": "jsmith@company.onmicrosoft.com"
},
"target": {
"path": "/destinationPath"
}
},
"simulation_mode": false
},
"schedule": {
"mode": "manual"
},
"stop_policy": {
"on_success": 5,
"on_failure": 5,
"on_execute": 25
},
"category": {
"name": "category name"
}
}