AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Разработка
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.07.2008, 12:08   #6  
AlekseyS is offline
AlekseyS
Участник
 
77 / 13 (1) ++
Регистрация: 30.07.2008
Адрес: Киев
Вот у меня работает на account:


//Create a new annotation object, which represents the notes you see in CRM.
annotation newsgroupsNote = new annotation();

//The annotation's body. It is displayed in the notes view.
newsgroupsNote.notetext = "Don't forget send document"; // - \r\n

//The objectid specifies to which business object the annotation belongs.
newsgroupsNote.objectid = new Lookup();
newsgroupsNote.objectid.type = EntityName.account.ToString();
newsgroupsNote.objectid.Value = new Guid(context.OutputParameters.Properties["id"].ToString());

//The objecttypecode specifies the type of the parent entity. Though explicitly specified in
//the objectid property, it must be set.
newsgroupsNote.objecttypecode = new EntityNameReference();
newsgroupsNote.objecttypecode.Value = EntityName.account.ToString();

//The subject. Not displayed in the note view, but when you double click the item,
//the dialog will display it.
newsgroupsNote.subject = "You should look ready document DOZ.\r\n";
///////////////////
//// RETRIEVE ACCOUNT ASSOCIATED WITH CURRENT REQUEST


////////////////////
//
// ent.name
//
// PROCESS DOCUMENT TEMPLATE
////////////////////
//Create the annotation
ICrmService service = context.CreateCrmService(true);
Guid annotID = service.Create(newsgroupsNote);

account ent = (account)service.Retrieve(EntityName.account.ToString(),
new Guid(context.OutputParameters.Properties["id"].ToString()), new AllColumns());

StreamReader reader = new StreamReader(@"c:\upload.doc");
string input = GetBase64StringFromFile(@"c:\upload.doc");
TargetUpdateAnnotation tua = new TargetUpdateAnnotation();
annotation oAnnotation = new annotation();
Key oKey = new Key();
oKey.Value = annotID;
oAnnotation.annotationid = oKey;
oAnnotation.filename =
oAnnotation.filename = ent.name + "_doz.doc";
oAnnotation.mimetype = "application/msword";
oAnnotation.documentbody = input;
CrmNumber oNumber = new CrmNumber();
oNumber.Value = 4;
oAnnotation.filesize = oNumber;
tua.Annotation = oAnnotation;
UpdateRequest req = new UpdateRequest();
req.Target = tua;
UpdateResponse resp = (UpdateResponse) service.Execute(req);
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Microsoft Dynamics CRM Team Blog: Building Rich-Client Dashboards for Microsoft Dynamics CRM with Windows Presentation Foundation Blog bot Dynamics CRM: Blogs 1 31.03.2009 13:24
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05
Microsoft Dynamics CRM Team Blog: Troubleshooting the Microsoft Dynamics CRM E-mail Router Blog bot Dynamics CRM: Blogs 0 09.01.2009 06:03
Microsoft Dynamics CRM Team Blog: Workflow E-mail Utilities Blog bot Dynamics CRM: Blogs 0 16.12.2008 23:05
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM E-mail Router and Exchange 2007: Keeping it Secure Blog bot Dynamics CRM: Blogs 0 14.07.2008 13:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 22:01.