Search code examples
azure-devops-rest-apiazure-devops-extensions

azure-devops-node-api: How to setDocumentByName in ProjectCollection scope


How to set document in ProjectCollection scope? I tries to call setDocumentByName method but ScopeType and ScopeValueparameters are requred. When I tries to set empty strings for these parameters it doesn't work.

import * as azdev from "azure-devops-node-api";
import extmgmtm = require("azure-devops-node-api/ExtensionManagementApi");

let authHandler = azdev.getPersonalAccessTokenHandler(token);
let connection = new azdev.WebApi(orgUrl, authHandler);

let api = await connection.getExtensionManagementApi();

  await api
    .setDocumentByName(
      {
        id: "key",
        value: inputString,
      },
      publisher,
      extensionName,
      "User",         //scopeType
      "Me",           //scopeValue
      "collection1"
    )
    .then((doc) => {
      console.log(doc);
    });

Solution

  • I found solution!

    For scopeType we need to use Default instead of User and Current for scopeValue instead of Me.