【发布时间】:2014-09-26 07:22:49
【问题描述】:
- 有可能吗?
- MS Dynamics 4.0 是否有公开的 Web 服务 API,可以 可能会做被要求做的事情?
- db scheman 是否足够简单,可以识别 包含用于导出文档的数据的表和行 相关元数据?
- 附件是否准确 存储在 CRM 的“注释”实体中?
【问题讨论】:
标签: web-services api export crm dynamics-crm-4
【问题讨论】:
标签: web-services api export crm dynamics-crm-4
Annotation 实体documentbody 字段中,数据编码为Base64 字符串。【讨论】:
这是一个 2011 版本,应该在很大程度上向后兼容并且涵盖了要点。
http://woodsworkblog.wordpress.com/2012/07/28/exporting-annotation-note-attachment/
public void ExportDocuments(IOrganizationService service, String filePath)
{
String fetch = @"<fetch mapping='logical' count='100' version='1.0'>
<entity name='annotation'>
<attribute name='filename' />
<attribute name='documentbody' />
<attribute name='mimetype' />
</entity>
</fetch>";
foreach (Entity e in service.RetrieveMultiple(new FetchExpression(fetch)))
{
if (!String.IsNullOrWhiteSpace(e.Attributes["documentbody"].ToString()))
{
byte[] data = Convert.FromBase64String(e.Attributes["documentbody"].ToString());
File.WriteAllBytes(filePath + e.Attributes["filename"].ToString(), data);
}
}
}
【讨论】: