Technical Guide – netDocShare Provisioning Tool

x-auth-key is the header token and must be passed in the header of every API call. This is mandatory to execute any endpoints in Teams API.

Prerequisite:

Register an application in Azure portal and make a note of app id and app secret of the application. Then add the following Microsoft Graph API permissions to the registered application. The app id and app secret will be required to create the x-auth-key.

AppCatalog.Read.All Application Read all app catalogs
AppCatalog.ReadWrite.All Application Read and write to all app catalogs
Channel.Create Application Create channels
ChannelMember.Read.All Application Read the members of all channels
ChannelMember.ReadWrite.All Application Add and remove members from all channels
Contacts.Read Application Read contacts in all mailboxes
Contacts.ReadWrite Application Read and write contacts in all mailboxes
Directory.Read.All Application Read directory data
Directory.ReadWrite.All Application Read and write directory data
Files.Read.All Application Read files in all site collections
Files.ReadWrite.All Application Read and write files in all site collections
Group.Read.All Application Read all groups
Group.ReadWrite.All Application Read and write all groups
Organization.Read.All Application Read organization information
Organization.ReadWrite.All Application Read and write organization information
profile Delegated View users’ basic profile
Team.Create Application Create teams
TeamMember.Read.All Application Read the members of all teams
TeamMember.ReadWrite.All Application Add and remove members from all teams
User.Read Delegated Sign in and read user profile
User.Read.All Delegated Read all users’ full profiles
User.Read.All Application Read all users’ full profiles
User.ReadWrite.All Application Read and write all users’ full profiles

x-auth-key should be created using the following information.

var obj = {

appId: string,
appSec: string,
tenantId: string,
key: string,
key2: nounce
}

Keys in the Object:

appId -> string – App Client Id

appSec -> string – App Client Secret

tenantId -> string – Tenant Id

key -> string – netDocShare License Key

key2 -> current date and time as nounce.

Example to generate key2:

  • In JavaScript, this will be created using the code Date.now().
  • In C#, this will be created using the code

Convert.ToString((DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1)).TotalMilliseconds + 0.5)

Using the above Keys the Object obj will be generated.

Base 64 Conversion:

The Object obj will be converted to Base64 format. This Base64 string will be the x-auth-key.

  • In JavaScript, this conversion will be “btoa(JSON.stringify(obj))
  • In C#, this conversion will be

var jsonData = JsonConvert.SerializeObject(obj).ToSrting)

System.Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(jsonData);

technical-guide-netDocShare-provisioning-1
  • The API base URL will be
    var baseURL = https://provisioning.netdocshare.com/api/v1.0

The full documentation of the API endpoints can be found in the below swagger link.

https://provisioning.netdocshare.com/api/v1.0/swagger/index.html

URL end point baseURL + “/msteams/teams”
Request Type POST
Header x-auth-key
Payload {teamName, teamDescription, visibility, isSync, adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.


Sync Job Data sample:

{  “syncType”: “teamUni”,

  “netDocuments”: {

    “userName”: “Admin m365 KLoBot Demo”,

    “cabinetId”: “NG-3MKEPV9J”,

    “cabinetName”: “Clients”,

    “repositoryId”: “CA-9ZYW8N4A”,

    “workspaceId”: “”,

    “workspaceName”: “”,

    “workspaceEnvId”: “”,

    “folderId”: “4884-4268-2150”,

    “folderName”: “SK123_Sync”,

    “breadCurmb”: [

      {

        “DocId”: “4868-8193-9491”,

        “Attributes”: {

          “Name”: “test”,

          “Ext”: “ndfld”

        },

        “EnvId”: “:Q13:j:g:y:b:^F220603070712019.nev|1”

      },

      {

        “DocId”: “4884-4268-2150”,

        “EnvId”: “:Q14:b:g:h:v:^F220628130300487.nev”,

        “Attributes”: {

          “Name”: “SK123_Sync”,

          “Ext”: “ndfld”

        }

      }

    ]

  }

}

URL end point baseURL + “/msteams/teams”
Request Type GET
Header x-auth-key
URL end point baseURL + “/msteams/teams/{id}”
Request Type GET
Header x-auth-key
Path String {id} – Team id
URL end point baseURL + “/msteams/teams/{id}”
Request Type PUT
Header x-auth-key
Path String {id} – Team id
Payload {teamName, teamDescription, visibility, memberesNew, memberesRemove}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/{id}”
Request Type DELETE
Header x-auth-key
Path String {id} – Team id

Create a looping logic to create a team with a dynamic payload.

URL end point baseURL + “/msteams/teams”
Request Type POST
Header x-auth-key
Payload {teamName, teamDescription, visibility, isSync, adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/{id}/channels”
Request Type POST
Header x-auth-key
Path String {id} – Team id
Payload {channelName, channelDescription, membershipType, isSync, adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.

SyncJobData sample in 4.1

URL end point baseURL + “/msteams/teams/{id}/channels”
Request Type GET
Header x-auth-key
Path String {id} – Team id
URL end point baseURL + “/msteams/teams/{tid}/channels/{id}”
Request Type GET
Header x-auth-key
Path String {tid} – Team id, {id} – Channel id
URL end point baseURL + “/msteams/teams/{tid}/channels/{id}”
Request Type PUT
Header x-auth-key
Path String {tid} – Team id, {id} – Channel id
Payload {channelName, channelDescription}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/{tid}/channels/{id}”
Request Type DELETE
Header x-auth-key
Path String {tid} – Team id, {id} – Channel id
Payload {channelName, channelDescription, membershipType, isSync, adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.

Create a looping logic to create a channel with dynamic payload.

URL end point baseURL + “/msteams/teams/{id}/channels”
Request Type POST
Header x-auth-key
Path String {id} – Team id
Payload {channelName, channelDescription, membershipType, isSync, adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/{tid}/channels/{cid}/tabs/netDocShare”
Request Type POST
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id
Payload {tabName, config}
Details of the payload can be found in the swagger documentation.

 

Config JSON string sample:

{        “viewType”:”RecentDoc”,

        “primarySource”:

        {

            “id”:””,

            “type”:””,

            “name”:””

        },

        “sources”:[]

    }

URL end point baseURL + “/msteams/teams/{tid}/channels/{cid}/tabs”
Request Type GET
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id
URL end point baseURL + “/msteams/teams/{tid}/channels/{cid}/tabs/{id}”
Request Type GET
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id, {id} – Tab id
URL end point baseURL + “/msteams/teams/{tid}/channels/{cid}/tabs/{id}”
Request Type PUT
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id, {id} – Tab id
Payload {tabName}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/{tid}/channels/{cid}/tabs/{id}”
Request Type DELETE
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id, {id} – Tab id

Create a looping logic to create a tab with dynamic payload.

URL end point baseURL + “/msteams/teams/{tid}/channels/{cid}/tabs/netDocShare”
Request Type POST
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id
Payload {tabName, config}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/bulkConfigUpdate”
Request Type POST
Header x-auth-key
Payload {data}
Details of the payload can be found in the swagger documentation.

 

data JSON string sample:

“data”: {    “config”: {

      “netcode”: false,

      “viewType”: “Tree”,

      “showLogo”: true,

      “showLogout”: true,

      “showSearchBox”: true,

      “metaWebPartListLocation”: “”,

      “metaWebPartTitle”: “”,

      “contextMenu”: [

        “post”,

        “checkin”,

        “checkout”,

        “post”

      ],

      “filters”: [],

      “CDNBaseUrl”: “https://klobotappsdev.azurewebsites.net/apps/netdocshare/srvc/”,

      “assetPath”: “https://klobotappsdev.azurewebsites.net/apps/netdocshare/assets/images/folderIcons”,

      “AuthSuffix”: “auth”,

      “docsPerPage”: “”,

      “searchCriteria”: {

        “field-date”: [

          “ewdw”

        ]

      },

      “ndThread”: false,

      “ndTasks”: true,

      “authPage”: “”,

      “menuSize”: “s”,

      “TableDisplayDocsOnly”: false,

      “clickBehavior”: “SLenabled”,

      “searchBehavior”: “searchCurrentView”,

      “workSpaceContentDisplay”: “ShowSummaryOrListView”,

      “showParentInfo”: false,

      “autoRefreshTimer”: 30,

      “mandatoryEditProfile”: true,

      “searchIn”: “title”,

      “showWorkspaceName”: true,

      “teamsPost”: true,

      “teamsPostComments”: true,

      “sources”: [

        {

          “id”: “4841-7567-1752”,

          “name”: “1000 – Ironside Works”,

          “type”: “workspace”,

          “cabinet”: “Clients”,

          “cabinetId”: “NG-3MKEPV9J”

        }

      ],

      “MSClientId”: “2cadc096-84c9-4183-b7a6-682ac908bdf0”

    },

    “teams”: [

      {

        “id”: “290d0a61-78ff-498f-b092-2c526bb0a198”,

        “channels”: [

          {

            “id”: “19:5424faa3789347cf900e6159034a1810@thread.tacv2”,

            “tabs”: [

              {

                “id”: “1cb89d15-317a-4451-a79b-2263822ad516”

              }

            ]

          }

        ]

      },

      {

        “id”: “290d0a61-78ff-498f-b092-2c526bb0a198”,

        “channels”: [

          {

            “id”: “19:5424faa3789347cf900e6159034a1810@thread.tacv2”,

            “tabs”: [

              {

                “id”: “d3541ff5-f4b3-4fbe-912d-a37dd02c31b8”

              },

              {

                “id”: “b4a65697-f499-416b-a667-44c8882906ce”

              },

              {

                “id”: “21f0bd24-c8bf-4527-b05e-74a909571376”

              },

              {

                “id”: “f1a2add5-d007-4062-a10a-60f4ea29fdbc”

              }

            ]

          }

        ]

      }

    ]

  }

URL end point baseURL + “/msteams/teams/{tid}/syncjob/create”
Request Type POST
Header x-auth-key
Path String {tid} – Team id
Payload { adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.

 

Sync Job Data sample:

{  “syncType”: “teamUni”,

  “netDocuments”: {

    “userName”: “Admin m365 KLoBot Demo”,

    “cabinetId”: “NG-3MKEPV9J”,

    “cabinetName”: “Clients”,

    “repositoryId”: “CA-9ZYW8N4A”,

    “workspaceId”: “”,

    “workspaceName”: “”,

    “workspaceEnvId”: “”,

    “folderId”: “4884-4268-2150”,

    “folderName”: “SK123_Sync”,

    “breadCurmb”: [

      {

        “DocId”: “4868-8193-9491”,

        “Attributes”: {

          “Name”: “test”,

          “Ext”: “ndfld”

        },

        “EnvId”: “:Q13:j:g:y:b:^F220603070712019.nev|1”

      },

      {

        “DocId”: “4884-4268-2150”,

        “EnvId”: “:Q14:b:g:h:v:^F220628130300487.nev”,

        “Attributes”: {

          “Name”: “SK123_Sync”,

          “Ext”: “ndfld”

        }

      }

    ]

  }

}

URL end point baseURL + “/msteams/teams/{tid}/channel/{cid}/syncjob/create”
Request Type POST
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id
Payload { adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/{tid}/syncjob/delete”
Request Type DELETE
Header x-auth-key
Path String {tid} – Team id
URL end point baseURL + “/msteams/teams/{tid}/channel/{cid}/syncjob/delete”
Request Type POST
Header x-auth-key
Path String {tid} – Team id, {cid} – Channel id
URL end point baseURL + “/msteams/teams/members”
Request Type POST
Header x-auth-key
Payload { searchUserString}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/members/add”
Request Type POST
Header x-auth-key
Payload { teamId, members}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/{tid}/channels/{id}/privateMembers”
Request Type GET
Header x-auth-key
Path String {tid} – Team id, {id} – Channel id
URL end point baseURL + “/msteams/teams/{id}/template”
Request Type POST
Header x-auth-key
Path String {id} – Template id
Payload { templateName, templateDescription, visibility }
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/template/{id}/clone”
Request Type POST
Header x-auth-key
Path String {id} – Template id
Payload { teamName, teamDescription, visibility, adminEmail}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/template”
Request Type GET
Header x-auth-key
URL end point baseURL + “/msteams/teams/template/{id}”
Request Type PUT
Header x-auth-key
Path String {id} – Template id
Payload { templateName, templateDescription, sync, syncType, config}
Details of the payload can be found in the swagger documentation.
URL end point baseURL + “/msteams/teams/template/{id}”
Request Type DELETE
Header x-auth-key
Path String {id} – Template id