Example #1
0
        public WorkItemDelete DeleteWorkItem(int id)
        {
            VssConnection connection = new VssConnection(_uri, _credentials);
            WorkItemTrackingHttpClient workItemTrackingHttpClient = connection.GetClient <WorkItemTrackingHttpClient>();
            WorkItemDelete             results = workItemTrackingHttpClient.DeleteWorkItemAsync(id, false).Result;

            return(results);
        }
Example #2
0
        public WorkItemDelete GetDeletedWorkItem()
        {
            int id = _id;

            VssConnection connection = Context.Connection;
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();

            WorkItemDelete result = workItemTrackingClient.GetDeletedWorkItemAsync(id).Result;

            return(result);
        }
Example #3
0
        public void PermenentlyDeleteWorkItem()
        {
            int id = _id;

            VssConnection connection = Context.Connection;
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();

            WorkItemDelete result = workItemTrackingClient.DeleteWorkItemAsync(id).Result;

            workItemTrackingClient.DestroyWorkItemAsync(id);
        }
Example #4
0
        public WorkItemDelete DeleteWorkItem()
        {
            int id = Convert.ToInt32(Context.GetValue <WorkItem>("$newWorkItem2").Id);

            // Get a client
            VssConnection connection = Context.Connection;
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();

            // Delete the work item (but don't destroy it completely)
            WorkItemDelete results = workItemTrackingClient.DeleteWorkItemAsync(id, destroy: false).Result;

            return(results);
        }
Example #5
0
        public WorkItemDelete RestoreItem(int id)
        {
            VssConnection connection = new VssConnection(_uri, _credentials);
            WorkItemTrackingHttpClient workItemTrackingHttpClient = connection.GetClient <WorkItemTrackingHttpClient>();

            WorkItemDeleteUpdate payload = new WorkItemDeleteUpdate()
            {
                IsDeleted = false
            };

            WorkItemDelete result = workItemTrackingHttpClient.RestoreWorkItemAsync(payload, id).Result;

            return(result);
        }
Example #6
0
        public WorkItemDelete RestoreWorkItem()
        {
            int id = _id;

            VssConnection connection = Context.Connection;
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();

            WorkItemDeleteUpdate updateParameters = new WorkItemDeleteUpdate()
            {
                IsDeleted = false
            };

            WorkItemDelete result = workItemTrackingClient.RestoreWorkItemAsync(updateParameters, id).Result;

            return(result);
        }
Example #7
0
        public WorkItemDelete DeleteWorkItems()
        {
            int id = _id;

            int[] ids = _ids;

            VssConnection connection = Context.Connection;
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();

            WorkItemDelete result = workItemTrackingClient.DeleteWorkItemAsync(id).Result;

            result = workItemTrackingClient.DeleteWorkItemAsync(ids[0]).Result;
            result = workItemTrackingClient.DeleteWorkItemAsync(ids[1]).Result;
            result = workItemTrackingClient.DeleteWorkItemAsync(ids[2]).Result;

            return(result);
        }
Example #8
0
        public WorkItemDelete DeleteWorkItem()
        {
            WorkItem workitem;

            if (!Context.TryGetValue <WorkItem>("$newWorkItem", out workitem) || workitem.Id == null)
            {
                Console.WriteLine("Run the create sample before running this.");
            }

            // Get a client
            VssConnection connection = Context.Connection;
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();

            // Delete the work item (but don't destroy it completely)
            WorkItemDelete results = workItemTrackingClient.DeleteWorkItemAsync(workitem.Id.Value, destroy: false).Result;

            return(results);
        }
Example #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="WIId">The specific work item Id need to delete</param>
        /// <returns></returns>
        public WorkItemDelete DeleteWITByID(int WIId)
        {
            WorkItemTrackingHttpClient witHttpClient = this.Connection.GetClient <WorkItemTrackingHttpClient>();

            try
            {
                WorkItemDelete result = witHttpClient.DeleteWorkItemAsync(WIId, destroy: false).Result;
                Console.WriteLine("Successfully Deleted Work Item: # {0}", result.Id);
                WriteLog.WriteLogLine("Successfully Deleted Work Item: # {0}", result.Id);
                return(result);
            }
            catch (AggregateException ex)
            {
                Console.WriteLine("Failed to delete Work Item: # {0} - Error Message: {1}", WIId, ex.InnerException.Message);
                WriteLog.WriteLogLine("Failed to delete Work Item: # {0} - Error Message: {1}", WIId, ex.InnerException.Message);
                return(null);
            }
        }