crm2011创建和读取注释
来源:互联网 发布:霸占大牛股选股软件 编辑:程序博客网 时间:2024/05/19 22:44
private string entityName = "annotation";
public void Create(IOrganizationService service)
{
string body = "Sample Annotation Text";
Entity entity = new Entity() { LogicalName = entityName };
//主题
entity["subject"] = "Example Annotation";
//文件名称
entity["filename"] = "ExampleAnnotationAttachment.txt";
//文件内容
entity["documentbody"] = Convert.ToBase64String(new UnicodeEncoding().GetBytes(body));
//文件下载类型
entity["mimetype"] = "text/plain";
//文件大小
entity["filesize"] = body.Length;
//关联的记录id
entity["objectid"] = Guid.NewGuid().ToString();
Guid _annotationId = service.Create(entity);
System.Console.WriteLine("创建注释结束");
}
public void Read(IOrganizationService service, Guid annotationId)
{
Entity entity = service.Retrieve(entityName, annotationId, new Microsoft.Xrm.Sdk.Query.ColumnSet("filename", "documentbody"));
string filename = entity["filename"].ToString();
string documentbody = entity["documentbody"].ToString();
using (System.IO.FileStream fileStream = new System.IO.FileStream(filename, System.IO.FileMode.OpenOrCreate))
{
byte[] fileContent = Convert.FromBase64String(documentbody);
fileStream.Write(fileContent, 0, fileContent.Length);
}
System.Console.WriteLine("读取文件结束");
}
- crm2011创建和读取注释
- crm2011创建String字段
- crm2011创建自定义视图
- crm2011创建int类型字段
- crm2011创建Boolean类型字段
- crm2011创建批量删除作业
- crm2011创建自定义实体Entity
- crm2011 停用和启用记录
- crm2011创建浮点类型的字段
- crm2011创建DateTime类型的字段
- crm2011创建货币Money类型的字段
- crm2011创建Picklist类型的字段
- crm2011创建Lookup类型的字段
- XML创建和读取
- oracle 读取表结构和注释
- CRM2011和CRM4.0表单区别
- crm2011 分配角色和删除角色
- crm2011导入和卸载事例数据
- 计算机图形学:任意点相对于任意平面的反射矩阵
- Android UI框架深度解析
- 2.Nginx安装
- 欧拉回路&特殊图下的哈密顿回路题集
- 怎样在systemverilog DPI中调用SV,C与C++(一)
- crm2011创建和读取注释
- Cairo 安装要点
- HTK on OS X
- MyEclipse中设置智能提示
- leetcode Distinct Subsequences
- Java中List的用法
- android JNI-SO函数名隐藏
- SQL主键和外键
- nginx基本配置与参数说明