という新しいエンティティの作成を提供するこのスニペットを見つけましたannotation
。ディレクティブXrmServicesContext
に宣言されたクラスが見つかりません 。using
これが一体何なのか誰か知ってる?
private static void AddNoteToContact(IOrganizationService service, Guid id)
{
Entity annotation = new Entity();
annotation.LogicalName = "annotation";
using (var crm = new XrmServicesContext(service))
{
var contact = crm.ContactSet.Where(c => c.ContactId == id).First();
Debug.Write(contact.FirstName);
annotation["createdby"] = new EntityReference("systemuser", new Guid("2a213502-db00-e111-b263-001ec928e97f"));
annotation["objectid"] = contact.ToEntityReference();
annotation["subject"] = "Creato con il plu-in";
annotation["notetext"] = "Questa note è stata creata con l'esempio del plug-in";
annotation["ObjectTypeCode"] = contact.LogicalName;
try
{
Guid annotationId = service.Create(annotation);
crm.AddObject(annotation);
crm.SaveChanges();
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// var note = new Annotation{
//Subject ="Creato con il plu-in",
//NoteText ="Questa note è stata creata con l'esempio del plug-in",
//ObjectId = contact.ToEntityReference(),
//ObjectTypeCode = contact.LogicalName
};
}