Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On This Page

Table of Contents

Overview

SharePoint content types are a type of custom metadata that allow you to categorize files. DryvIQ supports mapping content types between the source and destination. Currently, content type mapping is only available through the DryvIQ REST API.

Retrieving Content Type

You can send a GET message through the REST API to retrieve the metadata schema for a SharePoint/Office 365/OneDrive for Business connection. You can retrieve the metadata schema for a file or folder based on the path for the file or folder or the ID for the file or folder. The examples below provide sample code.

GET by File Path

Code Block
GET {{url}}v1/connections/{connectionID}/files/metadata_schema?path=FilePath

GET by File ID

Code Block
GET  {{url}}v1/connections/{connectionID}/files/{fileID}/metadata_schema

GET by Folder Path

Code Block
GET  {{url}}v1/connections/{connectionID}/folders/metadata_schema?path=FolderPath

GET by Folder ID

Code Block
GET  {{url}}v1/connections/{connectionID}/folders/{folderID}/metadata_schema

The call will return return the metadata schema that includes a field called ContentTypeId. This field will list all possible choices for the content type caption (name) and value pairs. You can use these values to set the ContentTypeId field for a file or folder in the metadata mapping.

Code Block
 },
                "ContentTypeId": {
                    "choices": [
                        {
                            "value": "Document_ID",
                            "caption": "Document"
                        },
                        {
                            "value": "Folder_ID",
                            "caption": "Folder"

Adding Content Types to the Metadata When Creating a Job

To set up content type metadata mapping when creating a job, you must create a choice map that maps the source values to destination the values using the information provided by the GET metadata_schema endpoint. This information is added to the metadat_map in the transfer block.

Code Block
{
    "transfer": {
            "metadata_map": {
                "schemas": [{
                        "mappings": [{
                                "source": {
                                    "property": {
                                        "name": "ContentTypeId"
                                    }
                                },
                                "destination": {
                                    "property": {
                                        "name": "ContentTypeId"
                                    }
                                },
                                "choices": [{
                                        "source": {
                                            "value": "0x010109008A55C32FB5DB9D4496723A82067F6F4D"
                                        },
                                        "destination": {
                                            "value": "0x010100C2138012BBD4B4439BD03ABF3FF6BCC7008AA8EF10A21C2042AC4CEC551BCA11F0"
                                        }
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}
Note

Make sure you only use each content type ID once. Listing the same content type ID twice will cause a duplicate database key error. This can happen if you duplicate a job with an existing content type map and then use the Advanced Scripting page in the UI to add JSON to map the content types again.