如何在crm 2011中将RequiredAttendees添加到约会

时间:2013-04-08 17:07:30

标签: dynamics-crm-2011 dynamics-crm

我正在尝试将帐户添加到约会的RequiredAttendees属性中。 我的代码完美适用于电子邮件,传真,信件。但是在创建约会时,不会添加该属性。

 string[] ToArr = new string[1];
            Guid To = Guid.Empty;
            try
            {
                if (Utility.To.Contains(";"))
                {
                    ToArr = Utility.To.Split(';');
                }
                else
                {
                    ToArr[0] = Utility.To;
                }

                EntityCollection collToParty = new EntityCollection();
                for (int i = 0; i < ToArr.Length; i++)
                {
                    if (Guid.TryParse(ToArr[i].ToString(), out To))
                    {

                        EntityReference to = new EntityReference(Utility.Toguidentityname, To);
                        Entity toParty = new Entity("activityparty");
                        toParty.Attributes.Add("partyid", to);
                        collToParty.EntityName = Utility.Toguidentityname;
                        collToParty.Entities.Add(toParty);
                    }
                    else
                    {
                        throw new Exception("Il valore del campo della stringa " + To + " toGuid non è un GUID:" + ToArr[i].ToString());

                    }
                }

                if (entity.LogicalName.Equals("appointment"))
                    entity.Attributes.Add("RequiredAttendees", collToParty);
                else
                    entity.Attributes.Add("to", collToParty);

            }
            catch (Exception ex)
            {
                LoggerObj.writeLog("Errore:" + ex.Message);
                throw;
            }

1 个答案:

答案 0 :(得分:1)

尝试小写RequiredAttendees

entity.Attributes.Add("requiredattendees", collToParty);