microsoft / azure-devops-dotnet-samples

.NET/C# samples for integrating with Azure DevOps Services and Azure DevOps Server
https://docs.microsoft.com/azure/devops/integrate
MIT License
522 stars 519 forks source link

VSTS organization URL helper samples #162

Open willsmythe opened 6 years ago

willsmythe commented 6 years ago

Samples showing how to properly construct a URL to a VSTS organization (formerly called "account") using either its name (e.g. "Fabrikam") or its GUID identifier.

Example of how to use the new helper:

public async Task DoSomething()
{
    Uri orgUrl = OrganizationUrlHelpers
        .GetConnectionUrl("myOrgName");  // typically resolves to https://myorgname.visualstudio.com

    VssConnection orgConnection = new VssConnection(orgUrl, credentials);

    BuildHttpClient buildClient = orgConnection.GetClient<BuildHttpClient>();
}
vtbassmatt commented 4 years ago

If you have a moment to retarget this at main, I'd still merge it.