Coder Social home page Coder Social logo

azure-devops-extension-api's Introduction

Azure DevOps Web API clients and contracts

azure-devops-extension-api's People

Contributors

amkan1993 avatar anandshankarms avatar arashmirhosseini avatar bcarthic avatar bworline avatar cadewey avatar clairebaire avatar clayplumridge avatar dependabot[bot] avatar dianagalarza avatar dpaquette avatar hross avatar kp101090 avatar lohitakshgupta avatar microsoft-github-policy-service[bot] avatar mihaelams1 avatar nkirchem avatar olaseeniolay avatar scottdallamura avatar thomabr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-devops-extension-api's Issues

Module type

Hi

Would it be possible to change the module type from amd to something else?
If it's still required (pun intended), is it possible to have it build out two builds to the npm package - or at least include the original source?

Build Results Service

In an attempt to add a new tab to the build results page using the ms.vss-build-web.build-results-view target and ms.vss-build-web.build-results-tab type I found that there doesn't seem to be a way to retrieve contextual information about a build that a user is viewing.

There is a IBuidPageData service, but it does not work on the build results view. If I try an manually try and grab the build ID (to use with the REST client) out of the parent window's URL I'll get a cross-site origin error.

Can something be added to retrieve build result information?

Related: build-results-enhancer

ILocationService.routeUrl documentation

Hi there,

I think we are all aware that the documentation for the API is not very complete (or existent at all). However, I am very pleased to use the new SDK in favour of the old one, and the fact that the code is open and very organized helps a lot with documentation as well.

One capability that I had on the old SDK was to build absolute URLs composed by the host URL + my extension contribution IDs e.g. ${hostUrl}/_settings/${vendorID}.${extensionID}.${contributionID}

Now, I can't find a way to get the host URL using the new SDK. I have found a very interesting method though, that seem to return the route for a given contribution ID, however, there is no way I can make it work:

ILocationService.routeUrl

Could you please let me know how to register routes and use the method above?

Thank you.

CORS error when using client

I am getting a CORS error when I am calling the REST API using the client. This is what I do:

import {getClient} from 'azure-devops-extension-api';
import * as SDK from 'azure-devops-extension-sdk';
import {WorkItemTrackingRestClient} from 'azure-devops-extension-api/WorkItemTracking';

const getRecent = async () => {
   await SDK.init();
   const client = getClient(WorkItemTrackingRestClient);
   const recent = await client.getRecentActivityData();
   return recent;
}

Looking at the samples I have seen, then I have not been able to figure out what I am missing.
Any ideas how I can get this working?

How I can get list users?

I create work-item-form extension.
How I can get list users?
I need to create identity user control, we use antd for UI but I cannot know how I can get list users

getArtifactContentZip is not working for pipeline artifacts

getArtifactContentZip is failing with an exception.

This happens because it calls {project}/_apis/build/builds/{buildId}/artifacts/{artifactName} with version 5.2-preview.5

The API returns a 302 redirecting it to artifact download URL

Since it is a redirect, it calls the redirect URL ( with the same version 5.2-preview.5 and the download URL doesn't support revision five of the preview (it supportes 5.2-preview.1 though), so the call fails a 404).

Patching the code to use either 5.2-preview.1 or just 5.2 with no preview fixes the problem.

This works fine if the artifact is of Container type since there is no redirect in that case. It only fails for PipelineArtifact resource types.

Guidance on how to get contribution instances?

I have been trying to find a way to get an instance of the contributions from a separate extension. This was documented through the Team Calendar extension, along with the VSTS Extension Sample: Calendar Public Events.

Both of these repositories utilize the older module: vss-web-extension-sdk.


The associated code is located on line 1072 of the VSS.SDK.js file. In that function it seems that there is a "getContributionsForTarget" function that is remotely invoked. Unforunately, I did not see anything similar with the azure-devops-extension-sdk or the azure-devops-extension-api. The SDK has listed quite a lot of functions which are implemented by doing a remote invocation as well, so it leads me to believe that perhaps the azure-devops-extension-sdk module is just incomplete?

Alternatively, I thought maybe this functionality was moved to the Contributions API. When using postman, I am able to send a post request just fine and get contribution information, even though this is not yet documented in the VSTS Rest API documentation (5.1 Preview): https://dev.azure.com/{organization}/_apis/Contribution/nodes/query?api-version=5.1-preview.1

Posting a query to that Uri returns me a json object that contains contribution information. I'm not sure what I can do with that information, whether or not that information is used to create an instance of the contribution for my primary extension to consume?

{
    "nodes": {
        "{publisherId}.{extensionId}.{contribution}": {
            "contribution": {
                "id": "...",
                "description": "...",
                "type": "{publisherId}.{extensionId}.{contributionType}",
                "targets": [
                    "..."
                ],
                "properties": {
                    "::Attributes": 0,
                    "::Version": "0.1.5",
                    "::BaseUri": "https://localhost:5000"
                }
            },
            "parents": [],
            "children": [
                "... contribution01",
                "... contribution02"
            ]
        },
        "... contribution01": {
            "contribution": {
                "id": "...",
                "description": "...",
                "type": "...",
                "targets": [
                    "..."
                ],
                "properties": {
                    "uri": "path/to/index.html",
                    "::Attributes": 0,
                    "::Version": "0.1.5",
                    "::BaseUri": "https://localhost:5000"
                }
            },
            "parents": [
                "..."
            ],
            "children": []
        },
        { ... contribution02 similar to above }
    },
    "providerDetails": {}
}

So, this almost seems like the way to go, maybe?


When I attempted to use the ContributionsRestClient I get an error I really have no idea how to debug: client = Client.getClient(ContributionsRestClient);

It's strange... because the source code for the getClient is not asynchronous, and the constructor for the ContributionsRestClient is definitely not asynchronous. So, I'm not really sure where the promise comes into affect? Even wrapping up the code in a try/catch block, it never reaches the catch section, so where is this promise actually occurring?

Uncaught (in promise) {
message: "Cannot read property 'locationUrl' of null"
stack: "TypeError: Cannot read property 'locationUrl' of null↵ at https://cdn.vsassets.io/ext/ms.vss-features/ext-services-content/ms.vss-features.ext-services-content.Zu5S_LyZNQSk5WjJ.min.js:1:15021"
}


Oh, and this time I made sure that the API versions matches up with the version on my organization account's ring. Version 17.144.28413.6 (so I used 1.144.3) so that the 144 matches up.

If this happens to be an SDK specific problem, then sorry about that. I don't want to double post, so I'm only going to post on here first,

Wrong API Types

Hi,

I used to call the REST api's directly and that worked fine. When i switched to use this library i noticed that lots of the types were incorrect or suddenly marked as required. It seems to require a decent amount of work to rectify so i want to understand what Microsofts plans are with this library before i open a pull request.

Is this meant to be used instead of encouraging people to just use fetch?

Equivalent for WorkItemFormService available?

Hi,
is this SDK already ready to use? I want to create a work item form control extension but couldn't find the WorkfItemFormService (or similar) of the former vss-web-extension-sdk. Due to bug microsoft/vss-web-extension-sdk#88, which prevented be from using react in my project, I was hoping I can use this SDK already.

Unfortunately the currently provided examples don't show how to create a work item form extension.

Continuously get 404 (Not Found) errors when using any Rest Client.

I downloaded the sample project (https://github.com/Microsoft/azure-devops-extension-sample) and the only modifications I had to make were:

  1. Publisher Id
  2. Manifest categories (It is now 'Azure Pipelines' instead of 'Pipelines').

I continuously get a 404 error no matter which client I attempt to use. The sample uses a WorkItemTrackingRestClient, but when I was working on my own project I tried to use the GitRestClient to get a list of repositories, same failure (404).

Here is a chrome dev tools log of the error from the sample:

GET https://dev.azure.com/{organization-removed}/Samples/_apis/wit/workItemTypes 404 (Not Found)
Failed to get items for PickList: 404: Not Found

And here is the source code file from the git repo: https://github.com/Microsoft/azure-devops-extension-sample/blob/master/src/Samples/WorkItemOpen/WorkItemOpen.tsx

Oh, and at first I thought maybe I had to wait until the SDK.ready() fired off, so I tried using SDK.ready().then(...) and placed my work inside the then, but I still cannot use any rest client. The sample project doesn't even do that though, so I'm not sure if that was a dead end or not.

Want to publish the Automation Test Results executed in Azure Devops to team members through(Mail or Teams)

I have developed a testing framework for automating the UWP Application using appium.
Created the build pipeline to run the tests in VM in Azure Devops and able to see the Test Results and summary.

But wanted this results to publish to my entire team of 12 members as soon as the Test Automation in the VM completes through Mail or Microsoft Teams

Can anyone help me on this, if anyone feels any blog or reference would be useful for the above issue. I am reachable @ [email protected]

gitGetItem not passing the GitVersionDescription version

I am creating a custom hub and for that I am trying to use the gitGetItem to read a file from the git repository. I have set GitVersionDescriptor as below:

            const versionDescriptor: GitVersionDescriptor = {
                version: branchName,
                versionOptions: GitVersionOptions.None,
                versionType: GitVersionType.Branch
            }

When i run the code the URL generated does not include the version query string, hence it is always returning the file from the master branch, whereas i want to read the file from the specified branch.

The URL being generated is: https://myaccount.visualstudio.com/my-project-guid/_apis/git/repositories/my-repo-guid/items?path=file.json&versionType=Branch&versionOptions=None

whereas it should be this:
https://myaccount.visualstudio.com/my-project-guid/_apis/git/repositories/my-repo-guid/items?path=file.json&versionType=Branch&versionOptions=None**&version=branchName**

Question - ServiceEndpoint Rest Client example

Hello,

I'm trying to use the ServiceEndpointRestClient and I got stuck. I couldn't find documentation out there...

Can you provide any examples?

What I want to do is call one of the data sources defined in a custom endpoint I have defined in my extension using executeServiceEndpointRequest().

This is all done from a web hub contribution so I can show the data returned by my endpoint in the html associated to the web hub when I click it. Does this make sense at all?

Thanks,

Documentation

Hi,
this repository is in lack of a serious documentation. The official Documentation still states the vss extension sdk as the way to go, yet it is not maintained anymore. I can not find any getting started guide and the samples arent enough (if they even work). If im wrong, can someone please point me in the right direction?

RestClientBase not generating right url if one of the query param is 0

I am calling -

getClient(WorkItemTrackingRestClient).getClassificationNode(project.id, TreeStructureGroup.Areas, undefined, 5);

to load area paths. This api needs an enum parameter (TreeStructureGroup.Areas), whose value is 0.

This is not working because the url generation logic is stripping out 0 from query param string.

https://github.com/Microsoft/azure-devops-extension-api/blob/22937f8332d27f69c2e90a44a1f2eac7cea9b218/src/Common/Util/Url.ts#L714

This line here checks for !value which would return true if value is 0, which seems wrong.

api-version 5.0 is not working on latest Azure DevOps Server (Dev17.M153.5)

When we update work item field using REST API providing api-version=5.0 as described in documentation, we get the following exception:
PATCH https://server/tfs/DefaultCollection/Project/_apis/wit/workitems/1111111?suppressNotifications=true&validateOnly=true&api-version=5.0

{
"$id": "1",
"innerException": null,
"message": "Specified method is not supported.",
"typeName": "System.NotSupportedException, mscorlib",
"typeKey": "NotSupportedException",
"errorCode": 0,
"eventId": 0
}

But it works with 4.1 or 5.0-preview.2 api-version provided.
Assume, corresponding client must be also updated: https://github.com/microsoft/azure-devops-extension-api/blob/master/src/WorkItemTracking/WorkItemTrackingClient.ts#L1662

Cannot use TFVC actions against Azure Devops 2019.1.1

Hello
I created an extension to retrieve a projects labels, this worked well in TFS2017.3.
but after the upgrade to Azure Devops 2019, I also updated the extension to use the latest version (1.157) of the API and the extension fails
with error:
"The requested REST API version of 5.2 is out of range for this server. The latest REST API version this server supports is 5.1."

please fix, Azure Devops 2019.1.1 uses 5.0-5.1 API version.

Support for Azure DevOps Services REST API version 6.0

In regards of issue #53, if this repository is still maintained, I've got another question.

I'm trying to run a pipeline from an Azure DevOps hub extension, using the azure-devops-extension-api.

The azure-devops-extension-api contains several rest client classes, such as the BuildRestClient class and the ReleaseRestClient class. Both of which I've successfully used methods from.

However, the azure-devops-extension-api doesn't contain any rest client class for the Runs - Run Pipeline Azure DevOps Services REST API. I'm suspecting that this is because this endpoint is new for the 6.0 version of the API, and so it hasn't been implemented in the azure-devops-extension-api yet.

Is there any way that I could use this azure-devops-extension-api to run a specified pipeline? Perhaps via the queueBuild method? I want to run a specific pipeline though, not a specific old build.

Since this repository hasn't been updated for quite a while, I'm wondering if a PipelineRestClient class, based on the Azure DevOps Services REST API Pipelines endpoint is to expect? Or, for that matter, any of the other new endpoints exposed in the 6.0 version.

How to query "WorkItemLinks"

I can create a wiql to get WorkItems and with Links.
But how can I use this query with this api?

Because the wiql is not using the WorkItems table. It use the WorkItemLinks table.
And the result object is different.
So I cannot use the "queryByWiql" method.

In the editor i can use something like this.

SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.Tags], [Microsoft.VSTS.TCM.Parameters], [Microsoft.VSTS.TCM.Steps], [System.AreaPath], [System.TeamProject] 
FROM WorkItemLinks 
WHERE (Source.[System.TeamProject] = @project 
and Source.[System.WorkItemType] = 'Test Case') 
and (Target.[System.TeamProject] = @project and Target.[System.WorkItemType] = 'User Story' and Target.[System.State] = 'Active') ORDER BY [System.Id] mode(MustContain)

And below is the result:
The payload object contains rows which are filled with the workitems.

Result:

{
	"data": {
		"ms.vss-work-web.work-item-query-data-provider": {
			"errorMessage": null,
			"data": {
				"queryRan": true,
				"wiql": "SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.Tags], [Microsoft.VSTS.TCM.Parameters], [Microsoft.VSTS.TCM.Steps], [System.AreaPath], [System.TeamProject] 
FROM WorkItemLinks 
WHERE (Source.[System.TeamProject] = @project 
and Source.[System.WorkItemType] = 'Test Case') 
and (Target.[System.TeamProject] = @project and Target.[System.WorkItemType] = 'User Story' and Target.[System.State] = 'Active') ORDER BY [System.Id] mode(MustContain)",
				"isLinkQuery": true,
				"columns": [
					{
						"name": "System.Id",
						"text": "ID",
						"fieldId": -3,
						"canSortBy": true,
						"width": 70,
						"isIdentity": false,
						"fieldType": 2
					},
					{
						"name": "System.WorkItemType",
						"text": "Work Item Type",
						"fieldId": 25,
						"canSortBy": true,
						"width": 75,
						"isIdentity": false,
						"fieldType": 1
					},
					{
						"name": "System.Title",
						"text": "Title",
						"fieldId": 1,
						"canSortBy": true,
						"width": 450,
						"isIdentity": false,
						"fieldType": 1
					},
					{
						"name": "System.AssignedTo",
						"text": "Assigned To",
						"fieldId": 24,
						"canSortBy": true,
						"width": 125,
						"isIdentity": true,
						"fieldType": 1
					},
					{
						"name": "System.State",
						"text": "State",
						"fieldId": 2,
						"canSortBy": true,
						"width": 75,
						"isIdentity": false,
						"fieldType": 1
					},
					{
						"name": "System.Tags",
						"text": "Tags",
						"fieldId": 80,
						"canSortBy": false,
						"width": 200,
						"isIdentity": false,
						"fieldType": 5
					},
					{
						"name": "Microsoft.VSTS.TCM.Parameters",
						"text": "Parameters",
						"fieldId": 14310499,
						"canSortBy": false,
						"width": 75,
						"isIdentity": false,
						"fieldType": 7
					},
					{
						"name": "Microsoft.VSTS.TCM.Steps",
						"text": "Steps",
						"fieldId": 14310498,
						"canSortBy": false,
						"width": 75,
						"isIdentity": false,
						"fieldType": 7
					}
				],
				"sortColumns": [
					{
						"name": "System.Id"
					}
				],
				"sourceIds": [],
				"linkIds": [],
				"targetIds": [],
				"pageColumns": [
					"System.Id",
					"System.WorkItemType",
					"System.TeamProject",
					"System.Rev",
					"System.Tags",
					"System.State",
					"System.AssignedTo",
					"System.Title",
					"Microsoft.VSTS.TCM.Parameters",
					"Microsoft.VSTS.TCM.Steps"
				],
				"payload": {
					"columns": [
						"System.Id",
						"System.WorkItemType",
						"System.TeamProject",
						"System.Rev",
						"System.Tags",
						"System.State",
						"System.AssignedTo",
						"System.Title",
						"Microsoft.VSTS.TCM.Parameters",
						"Microsoft.VSTS.TCM.Steps"
					],
					"rows": [ {results here}
]
				},
				"editInfo": {
					"sourceFilter": {
						"clauses": [
							{
								"logicalOperator": "And",
								"fieldName": "Work Item Type",
								"operator": "=",
								"value": "Test Case",
								"index": 1
							},
							{
								"logicalOperator": "And",
								"fieldName": "State",
								"operator": "=",
								"value": "Ready",
								"index": 2
							},
							{
								"logicalOperator": "And",
								"fieldName": "Area Path",
								"operator": "=",
								"value": "Q-now\\Test Team 1",
								"index": 3
							}
						],
						"groups": [],
						"maxGroupLevel": 0
					},
					"linkTypes": "Tested By",
					"linkTargetFilter": {
						"clauses": [
							{
								"logicalOperator": "And",
								"fieldName": "Work Item Type",
								"operator": "=",
								"value": "Requirement",
								"index": 1
							},
							{
								"logicalOperator": "And",
								"fieldName": "State",
								"operator": "=",
								"value": "Active",
								"index": 2
							},
							{
								"logicalOperator": "And",
								"fieldName": "Area Path",
								"operator": "=",
								"value": "Q-now\\Test Team 1",
								"index": 3
							}
						],
						"groups": [],
						"maxGroupLevel": 0
					},
					"mode": 2,
					"teamProject": "@project"
				}
			},
			"versionStamp": null
		}
	},
	"sharedData": {},
	"resolvedProviders": [
		{
			"id": "ms.vss-work-web.work-item-query-data-provider"
		}
	],
	"exceptions": null,
	"clientProviders": null,
	"scopeName": null,
	"scopeValue": null
}

I cannot find a service or this model in the api.

Is this api call and model missing?
Or how can I achieve this goal to query work items with a link condition?
(Query of Test Cases with linked User Stories)

Usage documentation of WorkItemTrackingProcessRestClient.getProcessWorkItemType

Hi there,

I am using the method WorkItemTrackingProcessRestClient.getProcessWorkItemType to retrieve work item types for a process. It works fine, however, it is not clear how to use the property icon from the response.

When I retrieve work item types for a project using the method WorkItemTrackingRestClient.getWorkItemTypes it returns an icon property that has the full URL of the icon, so I am able to render the icon properly. However, this method return not only the work item types associated with the process of that project, and that's why I want to use the other method mentioned above - WorkItemTrackingProcessRestClient.getProcessWorkItemType. The problem is that the icon property that the latter returns is just the name of the icon, such as task, rather than a URL to the image.

How can I render an icon using the Icon name? Using that icon name with the Icon component from Formula Design doesn't work.

Thank you.

wrong parameter type in queueBuild function

Hello,
I think there is a mistake in Azure DevOps REST Api documentation, which says you should provide Build object in request body when call queue build endpoint.
Therefor there is also mistake in queueBuild function which require also Build object as parameter.
In my opinion the request body should look like this
{ "definition": { "id": 1 }, "sourceBranch": "refs/heads/master", "sourceVersion": "", "reason": 1, "demands": [], "parameters": "{\"system.debug\":\"true\"}" }

Is there any workaround right now to queue build?

Checking if a user is part of a group in a project

I am creating a custom extension and for one of my requirements, i need to check if the user is part of a specific group or not and then enable or disable some content for the user.

For this i was trying to use the GraphClient. In that i do see some functions that i can use like checkMembershipExistence, but it requires subject descriptor and container descriptor. When i checked on that i could see that getDescriptor can be used to retrieve the descriptor, but then it requires storageKey and to retrieve storageKey we can use getStorageKey, but that requires subjectDescriptor.

So, can you please provide an example of how the GraphClient can be used in a custom extension?

I am trying to achieve something like this (retrieve all the groups for the currently logged in user):
https://docs.microsoft.com/en-us/rest/api/azure/devops/graph/memberships/list?view=azure-devops-rest-5.0#all_groups_for_a_use

I need to send the Test Report (From Automation) to set of team members, is there any Azure devops task for this?

I have developed a testing framework for automating the UWP Application using appium.
Created the build pipeline to run the tests in VM in Azure Devops and able to see the Test Results and summary in the pipeline itself like below. But few are demanding automated mails of the Automation Test Results

image

Require help on these 2 questions
1.Is there any devops task to send the HTML report to group members
or
2.How to parse the TRX files to generate HTML report and sent to team members

If any references are also given it would be helpful to proceed further

Can anyone help me on this, if anyone feels any blog or reference would be useful for the above issue. I am reachable @ [email protected]

Thank you.

IWorkItemFormNavigationService.openNewWorkItem in another project

Hello!

Is it possible to create new work item not in the "active" project, but in another organization project?

const navSvc = await SDK.getService<IWorkItemFormNavigationService>(
            WorkItemTrackingServiceIds.WorkItemFormNavigationService
        );
return await navSvc.openNewWorkItem(workItemTypeName, initialValues);

Is there a way to pass projectId or smth like this?

Opening of existing item using openWorkItem from other project works fine.

Thank you!

createOrUpdateClassificationNode in WorkItemTrackingRestClient not working as intended

When trying to use createOrUpdateClassificationNode in WorkItemTrackingRestClient gives 400 error during execution.

Code snippet:

        const client = getClient(WorkItemTrackingRestClient);

        const node: WorkItemClassificationNode = {
            _links: null,
            attributes: null,
            children: null,
            hasChildren: null,
            id: null,
            identifier: null,
            name: areaName,
            path: null,
            structureType: TreeNodeStructureType.Area,
            url: null
        };

        const response = await client.createOrUpdateClassificationNode(node, projectId, TreeStructureGroup.Areas);

When this code is executed the below URL is created:
https://dev.azure.com/{organization}/{project}/_apis/wit/classificationNodes/0

instead of this:
https://dev.azure.com/{organization}/{project}/_apis/wit/classificationnodes/Areas

Checking further in WorkItemTracking.d.ts:

/**
 * Types of tree structures groups.
 */
export declare enum TreeStructureGroup {
    Areas = 0,
    Iterations = 1
}

This is what is causing TreeStructureGroup.Areas to be replaced with 0 in the code: https://github.com/microsoft/azure-devops-extension-api/blob/master/src/WorkItemTracking/WorkItemTrackingClient.ts

Please fix this.

Is this repository being maintained?

Hi there,

I have been using the Azure DevOps API and SDK for a while now, as they are the latest tools for implementing Azure DevOps extensions.

It lacks a lot of documentation; sometimes I am able to figure out what I need directly from the code, but other times developers just need some documentation or usage examples to be able to use it. In these days that we talk a lot about Developer Experience, I can say it hasn't been a very good experience so far.

Additionally, there are quite a few issues/questions open - I have opened a couple of them myself - but they just don't get an answer.

Can we have a transparent update on how this repository is maintained, and what is the roadmap in terms of documentation and support?

Thank you.

ReleaseRestClient not work : error 401 but BuildRestClient is ok

Hello,
when i use the api release, i get a 401 error, while i am administrator on my project and my site azureDevOps

Thx for your help.

import * as SDK from "azure-devops-extension-sdk";
import { CommonServiceIds, IProjectPageService, getClient } from "azure-devops-extension-api";
import * as vsrelease from "azure-devops-extension-api/Release";
import * as vsbuild from "azure-devops-extension-api/Build";

await SDK.ready();
// get current project name
const projectService = await SDK.getService<IProjectPageService>(CommonServiceIds.ProjectPageService);
const project = await projectService.getProject();
let projectName = '';
if(project !== undefined) projectName = project.name;
console.log(projectName);

// get buildDefinitions = ok 
const buildDefinitions = await getClient(vsbuild.BuildRestClient).getDefinitions(
    projectName, undefined, undefined, undefined, 
    undefined, undefined, undefined, undefined, undefined, 
    undefined, undefined, undefined, true, true );
console.log(buildDefinitions);

// get releaseDefinitions   ==  error  401 ??
// {"$id":"1","innerException":null,"message":"TF400813: The user 'my admin guid' is not authorized to access this resource.","typeName":"Microsoft.TeamFoundation.Framework.Server.InvalidIdentityException, Microsoft.TeamFoundation.Framework.Server","typeKey":"InvalidIdentityException","errorCode":0,"eventId":3000}
const releaseDefinitions = await getClient(vsrelease.ReleaseRestClient).getReleaseDefinitions(projectName);
console.log(releaseDefinitions);

Can't hit git branches extensibility points

Hi,

I tried to add a sample to this project to hit some supposedly existing extensibility points, according to the documentation. It's a basic copy / paste from the Menu sample, and looks like this:

Actions/Actions.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <body>
        <script type="text/javascript" src="Actions.js" charset="utf-8"></script>
    </body>
</html>

Actions/Actions.ts

import "es6-promise/auto";
import * as SDK from "azure-devops-extension-sdk";
import { CommonServiceIds, IHostDialogService  } from "azure-devops-extension-api";

SDK.register('sample-action', () => {
    return {
        execute: async(context: any) => {
            const dialogSvc = await SDK.getService<IHostDialogService>(CommonServiceIds.HostDialogService);
            dialogSvc.openMessageDialog(`Context: ${JSON.stringify(context)}`, { showCancel:false });
        }
    }
});

SDK.init();

and finally Actions/Actions.json

{
    "contributions": [
        {
            "id": "sample-action",
            "type": "ms.vss-web.action",
            "targets": [
                "ms.vss-admin-web.collection-overview-toolbar-menu",
                "ms.vss-admin-web.projects-grid-menu",
                "ms.vss-admin-web.project-overview-toolbar-menu",
                "ms.vss-admin-web.teams-grid-menu",
                "ms.vss-build-web.completed-build-menu",
                "ms.vss-build-web.build-definition-menu",
                "ms.vss-releaseManagement-web.release-definition-explorer-context-menu",
                "ms.vss-releaseManagement-web.release-definition-explorer-toolbar-menu",
                "ms.vss-releaseManagement-web.release-editor-tool-bar-menu",
                "ms.vss-code-web.source-grid-item-menu",
                "ms.vss-code-web.source-tree-item-menu",
                "ms.vss-code-web.source-item-menu",
                "ms.vss-code-web.git-branches-tree-menu",
                "ms.vss-code-web.git-branches-summary-grid-menu",
                "ms.vss-code-web.git-branches-summary-grid-diff-menu",
                "ms.vss-code-web.pull-request-action-menu"
            ],
            "properties": {
                "text": "Sample action",
                "uri": "dist/Actions/Actions.html",
                "icon": "static/sample-icon.png",
                "registeredObjectId": "sample-action"
            }
        }
    ]
}

Some of these targets are still working (build, release, source), others don't. And I don't understand why the git related ones are not responding (ms.vss-code-web.git-branches-tree-menu, ms.vss-code-web.git-branches-summary-grid-menu and ms.vss-code-web.git-branches-summary-grid-diff-menu).

I checked all possible actions in the following pages without any luck. I event switched to the old UI to be sure:

Did I miss something? Are these extensibility points still valid?
Thanks

Dialog initial size

When defining an external dialog content like this:

    {
      "id": "my-dialog",
      "type": "ms.vss-web.external-content",
      "description": "My dialog",
      "targets": [],
      "properties": {
        "uri": "myDialog.html"
      }
    },

...and opening a custom dialog like this:

SDK.getService(CommonServiceIds.HostPageLayoutService).then(
      dialogService => {
        return dialogService.openCustomDialog(SDK.getExtensionContext().id + ".my-dialog", {
          title: "My dialog title",
          onClose: result => console.log(result)
        });
      }
    );

...it is not possible to set the dialog size beforehand. Alternatively, the dialog size needs to be set when the dialog content is initialized:

// myDialog.js
SDK.init();
await SDK.ready();
SDK.resize(440, 400);

This makes the UI experience not great because the dialog is firstly rendered very small and only after that the resize happens. It was possible to set the dialog size in advance when using the old SDK though.

Is this a missing feature, a bug, or maybe it is just not documented?

My suggestion would be to add "width" and "height" attributes to either the descriptor or the service that opens the dialog. The latter seems to be more interesting.

Thank you.

Devops Extension 404's when starting, but after refreshing, resolves.

I seem to deal with this a lot with the extension and haven't found anything about this anywhere else.

I have a extension that does some simple copy move on work items in bulk, and it work just fine, there is no issues.
The only thing is that a lot of times, when a user first enters the extension area (which is a hub on boards btw) a lot of times the page loads indefinitely, and behind the scenes you notice that it 404 on the html. once a person refreshes the page, it reloads and resolves and the full page loads correctly showing the hub.
I should also say that reloading once doesn't always cut it, some times you have to load multiple times, and it gets a bit annoying if you have to load more then 2x.

i was wondering if you had any idea what would cause this, because, as i've already described, i cant seem to find anything related, and it seems devops based.

image

Here is a picture of the extension loading indefinitely and the error message involved, as well as a few subsequent warning message.

Thank you and if i need to provide more information i can

Build.Attachment does not contain neccesary metadata

According to the docs BuildRestClient.getAttachments returns a Promise with a list of Attachment containing some Attachment metadata.

However none of this metadata is sufficient to get the actual Attachment contents using BuildRestClient.getAttachment

Furthermore, the Attachment interface in the actual API contains only the following properties:

export interface Attachment {
    _links: any;
    /**
     * The name of the attachment.
     */
    name: string;
}

Which is clearly not the same as this Attachment class

How do I get the required info (timelineId, recordId) of a build Attachment in order to download the Attachment contents with BuildRestClient.getAttachment?

It looks like the azure devops api itself also currently does not return enough information on getAttachments to use it to download attachment contents: https://docs.microsoft.com/en-us/rest/api/azure/devops/build/attachments/list?view=azure-devops-rest-5.1#attachment

AccountsRestClient broken

Hi I've been playing around with your api, and have found a bug with the accounts rest client.

const accountsClient = API.getClient(AccountsRestClient);
const user = SDK.getUser();

console.log(user);

accountsClient.getAccounts(undefined, user.id).then((accounts: Account[]) => {
    this.accountItems.value = accounts.map((account) => {
        return {
            id: account.accountId,
            data: account,
            text: account.accountName
        };
    });
});

When this code gets triggered the following GET request is created:
https://{ Account Name }.vssps.visualstudio.com/_apis/Accounts?memberId={ GUID }
This results in a 404 response.

After playing around, I figured out that { Account Name } has to be app for the REST endpoint to work. e.g. https://app.vssps.visualstudio.com/_apis/Accounts?memberId={ GUID }

How resolve conflicts with "Keep Target"

Hello,

I search how to resolve Pull Request Conflicts (with API Client). I must resolve all conflicts with "Keep Target". How define the gitConflictObject ?!!!

{
'_links': null,
'conflictId': null,
'conflictPath': null,
'conflictType': null,
'mergeBaseCommit': null,
'mergeOrigin': null,
'mergeSourceCommit': null,
'mergeTargetCommit': null,
'resolutionError': null,
'resolutionStatus': null,
'resolvedBy': null,
'resolvedDate': null,
'url': null
};

let gitConflits: GitInterfaces.GitConflict[] = await azureGitAPI.getPullRequestConflicts(repositoryId, myPR.pullRequestId);
gitConflits.forEach(function (gitConflit) {
if(gitConflit.resolutionStatus != GitInterfaces.GitResolutionStatus.Resolved)
{
if(gitConflit.conflictType == GitInterfaces.GitConflictType.EditEdit)
{
azureGitAPI.updatePullRequestConflict(gitConflictObject, repositoryId, myPR.pullRequestId, gitConflit.conflictId);
}
}
});```

How to update a release pipeline variable with 'dot' in its name?

I'm trying to update a release pipeline variable during release in a PowerShell task, with a Rest API call.
But it is throwing error since the variable has 'dot' in it.
Here is the variable : folders.0.environments.0.variables.0.value
It corresponds to a path in a json file which I would like to update during the release pipeline and use in the json file in a subsequent task.
So, how do I handle updating such pipeline variables with dot in them?
The script runs perfectly fine if I try to update a normal variable like "variable1".

  • Here is the code snippet if anyone would like to try and help resolve the issue.

  • Allow the Agent job to "Allow scripts to access the OAuth token"

  • Have a variable with 'dot' in it and make it "settable at release time"

  • Allow "edit release pipeline" in the security

$url = "https://vsrm.dev.azure.com/{Org}/{Project}/_apis/Release/definitions/$($env:RELEASE_DEFINITIONID)?api-version=5.0"

$ba = (":{0}" -f $env:SYSTEM_ACCESSTOKEN)
$ba = [System.Text.Encoding]::UTF8.GetBytes($ba)
$ba = [System.Convert]::ToBase64String($ba)
$header = @{Authorization=("Basic{0}" -f $ba);ContentType="application/json"}
$pipeline = Invoke-RestMethod -Uri $url -Headers $header 
Write-Host "Pipeline = $($pipeline | ConvertTo-Json -Depth 100)"

write-host "==========================================================" 
write-host "Update an existing variable named "folders.0.environments.0.variables.0.value" to its new value "
write-host "==========================================================" 

$pipeline.variables.folders.0.environments.0.variables.0.value.value = "updated value"

# $pipeline.variables.variablename.value = "updated value"
# works if variable value does not have a dot in it.
# example : $pipeline.variables.variable1.value = "updated value"  

#****************** update the modified object **************************
$json = @($pipeline) | ConvertTo-Json -Depth 99

$updatedef = Invoke-RestMethod -Uri $url -Method Put -Body $json -ContentType "application/json" -Headers $header

Problem creating nested classification nodes

Hey,

Let's hope this question ends up in the right place:

We have been struggling with this issue for quite a while now, what we are trying to achieve is to create nested classification nodes via the azure-devops-extension-api package according to the following structure:

-Root
--Release
---Sprint 1
---Sprint 2

This works as expected when using the REST-api directly but when we use the npm package the classification nodes gets created in a flat structure directly under the root node.

We have tried many different versions of the code below but since none of them works my question is as follows:

How do I create a child node under a parent?

// parent object 
  const parent = {
    name: "Parent",
    attributes: {
      startDate: new Date(),
      finishDate: addDays(new Date(), 10)
    },
    id: undefined,
    children: undefined,
    hasChildren: true,
    identifier: undefined,
    path: "",
    url: undefined,
    _links: undefined,
    structureType: TreeNodeStructureType.Iteration
  };

// create the parent object 
  const parentNode = await getClient(
    WorkItemTrackingRestClient
  ).createOrUpdateClassificationNode(
    parent
    projectId,
    TreeStructureGroup.Iterations
  );


// child object 
  const child = {
    name: "Child",
    attributes: {
      startDate: new Date(),
      finishDate: addDays(new Date(), 10)
    },
    id: undefined,
    children: undefined,
    hasChildren: true,
    identifier: undefined,
    path: "Parent",
    url: undefined,
    _links: undefined,
    structureType: TreeNodeStructureType.Iteration
  };

// create the child node 
  const childNode = await getClient(
    WorkItemTrackingRestClient
  ).createOrUpdateClassificationNode(
    child,
    projectId,
    TreeStructureGroup.Iterations
  );

User entitlement api missing?

Hi,

I did not find any service in the api for user entitlement. Why is this missing?

I can't use graph api for my extension as it's must be compatible with on-premise DevOps.

How can can I check if a user is member of a group?

Typos in Release/Release.ts interfaces

Hello, Matt from Microsoft Office's Release and Delivery Experience (RDX) team here. First of, great work on the samples - they were super simple, intuitive and clear!

I wish to share feedbacks on two small bugs I found in src/Release/Release.ts

export interface ReleaseDefinition extends ReleaseDefinitionShallowReference {
    /**

     * Gets or sets the list of triggers.

     */

    triggers: ReleaseTriggerBase[];
}

Should be

export interface ReleaseDefinition extends ReleaseDefinitionShallowReference {
    /**

     * Gets or sets the list of triggers.

     */

    triggers: ArtifactSourceTrigger[];
}

and

export interface ReleaseDefinitionEnvironment {
    /**

     * Gets or sets the deploy phases of environment.

     */

    deployPhases: DeployPhase[];
}

should be

export interface ReleaseDefinitionEnvironment {
    /**

     * Gets or sets the deploy phases of environment.

     */

    deployPhases: AgentBasedDeployPhase[];
}

Source: https://github.com/microsoft/azure-devops-node-api

These are simply typos. When I made the above changes in my local repo, I was able to access "hidden" data from the definitions.

Thanks!

calling extDataService.getExtensionDataManager() in some cases locks up javascript

Calling
{
await SDK.ready();
const accessToken = await SDK.getAccessToken();
const extDataService = await SDK.getService(CommonServiceIds.ExtensionDataService);
this._dataManager = await extDataService.getExtensionDataManager(SDK.getExtensionContext().id, accessToken);
}

from inside of a modal locks up the browser under the following situations...

  1. from a context menu load on the WorkItem, when the WorkItem was loaded from the Sprint screen
  2. When using the Context Menu to open the Modal after a work item has been opened and closed on the Backlog screen

note:

  • The code works on the Backlog screen if you do not open a work item
  • The code works on the Sprint screen from the workitem table, but not from the ... (context menu) inside a workitem if you open a work item for details.

Unable to call getAttachmentContent for WorkItemTrackingRestClient

When I use the following code:
let client: WorkItemTrackingRestClient = API.getClient(WorkItemTrackingRestClient);
let attachment:ArrayBuffer = await client.getAttachmentZip("6072306", "AutoTriageProject", "hello-world.html", true);

I get this error: TFS.WebApi.Exception: 400: Bad Request Fetch.js:140

I used Postman to call the Rest API directly:
https://{{coreServer}}/{{organization}}/AutoTriageProject/_apis/wit/workitems/6?api-version={{api-version}}&$expand=relations
in order to get the id for the attachment I want.

How to create a specific work item (Bug) for each failed test case in Azure DevOps pipelines

Its not an Issue but need help for the problem

I'm using VS Test task for automated testing as part of my release pipeline in Azure DevOps. In build pipeline, there is option to create a bug if whole build fails as part of definition. I do not see that in release definition.

But i'm curious to find, if i have 5 test cases in a test suite and 2 test cases got failed and 3 test cases got passed. So is there any way to create a work item (bug) for only each of the failed test cases as part of release pipeline.

Please suggest me if that option is available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.