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 !!