Technical Guide – netDocShare Provisioning Tool

Token
x-auth-key

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
Generate x-auth-key

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

key -> string – netDocShare License Key

tenantId -> string – Tenant Id

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);

API URL
Base URL
  • The API base URL will be
    var baseURL = https://provisioning.netdocshare.com/api/v1.0
Swagger

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

Teams API
Create a Team
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”

        }

      }

    ]

  }

}

List all Teams
URL end point baseURL + “/msteams/teams”
Request Type GET
Header x-auth-key
Fetch a Team
URL end point baseURL + “/msteams/teams”
Request Type GET
Header x-auth-key
Path String {id} – Team id
Update a Team
URL end point baseURL + “/msteams/teams”
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.
Delete a Team
URL end point baseURL + “/msteams/teams”
Request Type DELETE
Header x-auth-key
Path String {id} – Team id
Create multiple Teams
URL end point baseURL + “/msteams/teams”
Request Type POST
Header x-auth-key
Path String {id} – Team id
Payload {teamName, teamDescription, visibility, isSync, adminEmail, syncJobData}
Details of the payload can be found in the swagger documentation.
Channels
Create multiple Teams
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

List all Channels
URL end point baseURL + “/msteams/teams/{id}/channels”
Request Type GET
Header x-auth-key
Path String {id} – Team id
Fetch a Channels
URL end point baseURL + “/msteams/teams/{tid}/channels/{id}”
Request Type GET
Header x-auth-key
Path String {tid} – Team id, {id} – Channel id
Update a Channels
URL end point baseURL + “/msteams/teams/{tid}/channels/{id}”
Request Type GET
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.
Delete a Channel
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 multiple Channels

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

URL end point baseURL + “/msteams/teams/{tid}/channels/{id}”
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.
netDocShare Tab
Create a netDocShare Tab
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”:[]

    }

List all netDocShare Tabs
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
Fetch a netDocShare Tab
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
Update a netDocShare Tab
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.
Delete a netDocShare Tab
URL end point baseURL + “/msteams/teams/{tid}/channels/{cid}/tabs/{id}”
Request Type DELETE
Header x-auth-key
Path String {tid} – Team id, {id} – Channel id
Create Multiple netDocShare Tabs

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.
Bulk update of netDocShare Tab config

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

URL end point baseURL + “/msteams/teams/bulkConfigUpdate”
Request Type POST
Header x-auth-key
Path String {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:[email protected]”,

            “tabs”: [

              {

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

              }

            ]

          }

        ]

      },

      {

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

        “channels”: [

          {

            “id”: “19:[email protected]”,

            “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”

              }

            ]

          }

        ]

      }

    ]

  }

Sync
Create Team Sync
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”

        }

      }

    ]

  }

}

Create Channel Sync
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.
Delete Team Sync
URL end point baseURL + “/msteams/teams/{tid}/syncjob/delete”
Request Type DELETE
Header x-auth-key
Path String {tid} – Team id
Delete Channel Sync
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
Members
Search Members
URL end point baseURL + “/msteams/teams/members”
Request Type POST
Header x-auth-key
Path String {tid} – Team id
Payload { searchUserString}
Details of the payload can be found in the swagger documentation.
Add Members to a Team
URL end point baseURL + “/msteams/teams/{tid}/syncjob/create”
Request Type POST
Header x-auth-key
Payload { teamId, members}
Details of the payload can be found in the swagger documentation.
List Channel Private Members
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
Template
Convert a Team to Template
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.
Clone a Team from Template
URL end point baseURL + “/msteams/teams/template/{id}/clone”
Request Type POST
Header x-auth-key
Path String {id} – Template id
Payload { teamId, members}
Details of the payload can be found in the swagger documentation.
List all Templates
URL end point baseURL + “/msteams/teams/template”
Request Type GET
Header x-auth-key
Update a Template
URL end point baseURL + “/msteams/teams/template/{id}”
Request Type GET
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.
Delete a Template
URL end point baseURL + “/msteams/teams/template/{id}”
Request Type DELETE
Header x-auth-key
Path String {id} – Template id