Esempio n. 1
0
        public WebApiTagDefinition UpdateTag()
        {
            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.UpdateTagAsync(projectId, tagId, "Pretty Monkey", true).Result;

                Console.WriteLine("Tag successfully updated");
                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);
            }
        }
Esempio n. 2
0
        public WebApiTagDefinition UpdateTag()
        {
            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.UpdateTagAsync(projectId, tagId, "Pretty Monkey", true).Result;

            if (tag == null)
            {
                Console.WriteLine("Error updating tag: ", tagId);
            }
            else
            {
                Console.WriteLine("Tag successfully updated");
                Console.WriteLine("Name:   {0}", tag.Name);
                Console.WriteLine("Id:     {0}", tag.Id.ToString());
                Console.WriteLine("Active: {0}", tag.Active.ToString());
            }

            return(tag);
        }