Dynamics crm 2011 如何在Microsoft CRM 2011中找到队列的Id?

Dynamics crm 2011 如何在Microsoft CRM 2011中找到队列的Id?,dynamics-crm-2011,Dynamics Crm 2011,我试图通过编程方式将任务添加到队列中。我发现这个示例代码:,但它只是创建队列,而不是使用现有的队列。有没有一种简单的方法可以找到队列的id 我明白了。我发现可以使用高级查找工具生成FetchXML。使用它,我可以查询我的队列,然后获取ID 以下是我最终使用的: string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>

我试图通过编程方式将任务添加到队列中。我发现这个示例代码:,但它只是创建队列,而不是使用现有的队列。有没有一种简单的方法可以找到队列的id

我明白了。我发现可以使用高级查找工具生成FetchXML。使用它,我可以查询我的队列,然后获取ID

以下是我最终使用的:

string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                      <entity name='queue'>
                        <attribute name='name' />
                        <attribute name='emailaddress' />
                        <attribute name='queueid' />
                        <order attribute='name' descending='false' />
                        <filter type='and'>
                          <condition attribute='name' operator='eq' value='{0}' />
                        </filter>
                      </entity>
                    </fetch>";    

EntityCollection result = service.RetrieveMultiple(new FetchExpression(String.format(fetchXml, queueName)));
var myQueue = (Queue)result.Entities[0];
Console.WriteLine(myQueye.Id);
string fetchXml=@”
";    
EntityCollection结果=service.RetrieveMultiple(新的FetchExpression(String.format(fetchXml,queueName));
var myQueue=(Queue)result.Entities[0];
Console.WriteLine(myQueye.Id);