How to close live work items or deactivate queue items
You can use the following sample code in your Console App (.NET framework) of Visual Studio to trigger the closure of live work items by deactivating the associated queue item.
For information about how you can modify the sample code to suit your environment, go to Quickstart: Organization service sample (C#).
static void Main(string[] args)
{
// e.g. https://yourorg.crm.dynamics.com
string url = "<your environment url>";
// e.g. you@yourorg.onmicrosoft.com
string userName = "<your user name>";
// e.g. y0urp455w0rd
string password = "<your password>";
string conn = $@"
Url = {url};
AuthType = OAuth;
UserName = {userName};
Password = {password};
AppId = 51f81489-12ee-4a9e-aaae-a2591f45987d;
RedirectUri = app://58145B91-0C36-4500-8554-080854F2AC97;
LoginPrompt=Auto;
RequireNewInstance = True";
using (var svc = new CrmServiceClient(conn))
{
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse response = (WhoAmIResponse)svc.Execute(request);
Console.WriteLine("Your UserId is {0}", response.UserId);
try
{
//Provide queueitem id as the second parameter which has to be deactivated.
svc.UpdateStateAndStatusForEntity("queueitem", new Guid("6f15a7f0-8788-eb11-a812-000d3a593524"), 1, 2);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine("Press any key to exit.");
Console.ReadLine();
}
}
Related information
Overview of unified routing
Set up unified routing
How unified routing affects queue items and the corresponding APIs
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기