简体   繁体   English

如何在Dynamics CRM中使用C#在CalendarRulesType属性中添加数据

[英]How to add data in CalendarRulesType attribute using c# in Dynamics CRM

Can anybody give an example or ref link for how to add data or create a record with CalenderRules type attribute using c# in dynamics crm. 任何人都可以在Dynamics crm中使用c#给出如何添加数据或使用CalenderRules type属性创建记录的示例或参考链接。

Information about CalenderRules type attribute is displayed in below link.but can't find actually how to add. 有关CalenderRules类型属性的信息显示在下面的链接中,但实际上找不到添加方法。

https://msdn.microsoft.com/en-in/library/dn817862.aspx#BKMK_Image https://msdn.microsoft.com/zh-in/library/dn817862.aspx#BKMK_Image

From the article you have referenced. 从您已引用的文章中。

There are no actual attributes that use the CalendarRulesType . 没有使用CalendarRulesType的实际属性 When using the early binding style, the code generation tool will create the following two simulated attributes that are not present in the metadata. 使用早期绑定样式时,代码生成工具将创建元数据中不存在的以下两个模拟属性。 These attributes actually represent a view of the calendar rules records associated in a one-to-many relationship to the entity instance . 这些属性实际上代表与实体实例一对多关联的日历规则记录的视图。

Just like any other relationship, you can use Associate or just use the early/late bound attributes and reference the entity collection: 就像任何其他关系一样,您可以使用“ 关联”或仅使用“早/晚绑定”属性并引用实体集合:

Early/Late bound: 早/晚绑定:

calendar.CalendarRules = new[]
{
   new CalendarRule()
   {
      Id = calendarRuleId
   }
};

Associate: 关联:

 organizationService.Associate(Calendar.EntityLogicalName, calendarId, new Relationship("calendar_calendar_rules"),
                new EntityReferenceCollection(new[]
                {
                    new EntityReference(CalendarRule.EntityLogicalName, calendarRuleId)
                }));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM