Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 123975

Blog Post: Create and attach text file to notes in Microsoft CRM 2011

$
0
0

If you have requirement to create and attach file to notes in Ms CRM 2011 using code then this post is for you, you can use below code

string strMessage=”this is a demo”;
byte[] filename = Encoding.ASCII.GetBytes(strMessage);
string encodedData = System.Convert.ToBase64String(filename);
Entity Annotation = new Entity(“annotation”);
Annotation.Attributes["objectid"] = new EntityReference(“EntityName”,GUID);
Annotation.Attributes["objecttypecode"] = “EntityNAME”;
Annotation.Attributes["subject"] = “Demo”;
Annotation.Attributes["documentbody"] = encodedData;
Annotation.Attributes["mimetype"] = @”text/plain”;
Annotation.Attributes["notetext"] = “Sample attachment.”;
Annotation.Attributes["filename"] = “Demo.txt”;
Service.Create(Annotation);

Enjoy !!



Viewing all articles
Browse latest Browse all 123975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>