带有PartyList的QueryExpression中的错误 [英] Error in QueryExpression with PartyList

查看:52
本文介绍了带有PartyList的QueryExpression中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从帐户列表中检索其必需的参与者包含在实体之一中的约会。 required与会者的类型为PartyList。
我的查询如下:

I'm trying to retrieve appointments whose "requiredattendees" contains on one of entities from account list. requiredattendees have a type of PartyList. My query looks like:

var query = new QueryExpression("appointment")
{
      ColumnSet = columnSet,
      Criteria = new FilterExpression(LogicalOperator.Or)
};

添加条件:

GetAccounts()
.Select(a => new ConditionExpression("requiredattendees", ConditionOperator.Contains, a.Id))
.ForEach(c => query.Criteria.AddCondition(c));


a.Id is the account guid.

我遇到以下错误:

Cannot add attribute requiredattendees of type partylist in a condition
System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral]]


推荐答案

进行服务预约,但是如果我没记错的话,预约也是一样。希望这对您有帮助

This code is for serviceappointment, but if i remember right, it's just the same for appointment. Hope this helps

QueryExpression qe = new QueryExpression
{
    EntityName = "serviceappointment",
    Criteria = new FilterExpression
    {
        FilterOperator = LogicalOperator.And,
        Conditions = 
        {
            new ConditionExpression
            {
                AttributeName = "scheduledstart", 
                Operator = ConditionOperator.LessThan,
                Values = 
                {
                    endTime
                }
            },
            new ConditionExpression
            {
                AttributeName = "scheduledend",
                Operator = ConditionOperator.GreaterThan,
                Values =
                {
                    startTime
                }
            }
        }
    },
    LinkEntities = 
    {
        new LinkEntity
        {
            LinkFromEntityName = "activitypointer",
            LinkFromAttributeName = "activityid",
            LinkToEntityName = "activityparty",
            LinkToAttributeName = "activityid",
            LinkCriteria = new FilterExpression
            {
                FilterOperator = LogicalOperator.And,
                Conditions = 
                {
                    new ConditionExpression
                    {
                        AttributeName = "partyid",
                        Operator = ConditionOperator.Equal,
                        Values = 
                        {
                            someEntity.id
                        }
                    }
                }
            }
        }
    }
};

这篇关于带有PartyList的QueryExpression中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆