зеркало из
1
0
Форкнуть 0

added methods to wit recycle bin samples

This commit is contained in:
Dan Hellem 2017-06-07 08:40:25 -07:00
Родитель fc7960a62c
Коммит 0ec65c4799
1 изменённых файлов: 49 добавлений и 1 удалений

Просмотреть файл

@ -37,6 +37,18 @@ namespace Microsoft.TeamServices.Samples.Client.WorkItemTracking
return result;
}
[ClientSampleMethod]
public List<WorkItemDeleteReference> GetMultipledDeletedWorkItems()
{
int[] ids = { 72, 73, 81 }; //TODO
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItemDeleteReference> result = workItemTrackingClient.GetDeletedWorkItemsAsync(ids).Result;
return result;
}
[ClientSampleMethod]
public WorkItemDelete RestoreWorkItem()
{
@ -54,6 +66,26 @@ namespace Microsoft.TeamServices.Samples.Client.WorkItemTracking
return result;
}
[ClientSampleMethod]
public void RestoreMultipleWorkItems()
{
int[] ids = { 72, 73, 81 }; //TODO
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItemDeleteReference> result = workItemTrackingClient.GetDeletedWorkItemsAsync(ids).Result;
WorkItemDeleteUpdate updateParameters = new WorkItemDeleteUpdate() {
IsDeleted = false
};
foreach (var item in result)
{
var restore = workItemTrackingClient.RestoreWorkItemAsync(updateParameters, Convert.ToInt32(item.Id)).Result;
}
}
[ClientSampleMethod]
public void PermenentlyDeleteWorkItem()
{
@ -63,6 +95,22 @@ namespace Microsoft.TeamServices.Samples.Client.WorkItemTracking
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
workItemTrackingClient.DestroyWorkItemAsync(workItemId);
}
}
[ClientSampleMethod]
public void PermenentlyDeleteMultipleWorkItems()
{
int[] ids = { 72, 73, 81 }; //TODO
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItemDeleteReference> result = workItemTrackingClient.GetDeletedWorkItemsAsync(ids).Result;
foreach(var item in result)
{
workItemTrackingClient.DestroyWorkItemAsync(Convert.ToInt32(item.Id));
}
}
}
}