要保存一个文档并引用它在Dynamics CRM 2015中,你可以使用以下代码示例:
// 创建一个新的注释对象
Annotation annotation = new Annotation();
// 设置注释的相关属性
annotation.Subject = "文档标题";
annotation.NoteText = "文档内容";
annotation.ObjectId = new EntityReference(entityLogicalName, entityId);
// 创建一个CRM服务对象
IOrganizationService service = new OrganizationServiceProxy(new Uri("https://your-crm-url/XRMServices/2011/Organization.svc"),
null, credentials, null);
// 将注释保存到CRM
service.Create(annotation);
在上述代码示例中,你需要将以下部分替换为特定于你的环境的值:
"文档标题"
:替换为你要保存的文档标题。"文档内容"
:替换为你要保存的文档内容。entityLogicalName
:替换为与注释相关的实体的逻辑名称。例如,如果你要将注释与帐户实体相关联,则可以将其替换为"account"
。entityId
:替换为与注释相关的实体的ID。在上述代码示例中,我们使用了Create
方法将注释保存到Dynamics CRM 2015中。你还可以使用其他方法来更新或检索注释。
希望这个代码示例能帮助到你!
下一篇:保存一个用于获取帖子的结构