public WebApiTagDefinition GetTagById() { Guid projectId = ClientSampleHelpers.FindAnyProject(this.Context).Id; Guid tagId = new Guid("C807AEE9-D3FA-468D-BFD5-66C2B3D42AD3"); //TODO VssConnection connection = Context.Connection; TaggingHttpClient taggingClient = connection.GetClient <TaggingHttpClient>(); try { WebApiTagDefinition tag = taggingClient.GetTagAsync(projectId, tagId).Result; Console.WriteLine("Name: {0}", tag.Name); Console.WriteLine("Id: {0}", tag.Id.ToString()); Console.WriteLine("Active: {0}", tag.Active.ToString()); return(tag); } catch (AggregateException ex) { if (ex.InnerException.GetType().Equals(typeof(TagNotFoundException))) { Console.WriteLine("TagId '{0}' not found", tagId); } else { Console.WriteLine("Error: {0}", ex.Message); } return(null); } }
public WebApiTagDefinition GetTagById() { Guid projectId = ClientSampleHelpers.FindAnyProject(this.Context).Id; Guid tagId = new Guid("C807AEE9-D3FA-468D-BFD5-66C2B3D42AD3"); //TODO VssConnection connection = Context.Connection; TaggingHttpClient taggingClient = connection.GetClient <TaggingHttpClient>(); WebApiTagDefinition tag = taggingClient.GetTagAsync(projectId, tagId).Result; if (tag == null) { Console.WriteLine("Tag '{0}' not found", tagId); } else { Console.WriteLine("Name: {0}", tag.Name); Console.WriteLine("Id: {0}", tag.Id.ToString()); Console.WriteLine("Active: {0}", tag.Active.ToString()); } return(tag); }
public WebApiTagDefinition GetTagByName() { Guid projectId = ClientSampleHelpers.FindAnyProject(this.Context).Id; string tagName = "test"; //TODO VssConnection connection = Context.Connection; TaggingHttpClient taggingClient = connection.GetClient <TaggingHttpClient>(); WebApiTagDefinition tag = taggingClient.GetTagAsync(projectId, tagName).Result; if (tag == null) { Console.WriteLine("Tag '{0}' not found", tagName); } else { Console.WriteLine("Name: {0}", tagName); Console.WriteLine("Id: {0}", tag.Id.ToString()); Console.WriteLine("Active: {0}", tag.Active.ToString()); } return(tag); }