2016-06-21 20 views

答えて

0

あなたが達成しようとしていることは、不可能ではありませんが、カスタムワークフローアクティビティを作成し、プログラムによってSharePointからファイルを読み込み、バイトコード配列をbase64文字列としてアクティビティ本文に書き込みます電子メールを作成して添付ファイルとして電子メールに添付して送信します。

 var email = new Email 
     { 
      Subject = "Email with attachment from SharePoint.", 
      Description = "Find the document attached.", 
      From = 
       new[] 
       { 
        new ActivityParty() { PartyId = new CrmEntityReference(SystemUser.EntityLogicalName, fromUserGuid) } 
       }, 
      To = 
       new[] 
       { 
        new ActivityParty() { PartyId = new CrmEntityReference(SystemUser.EntityLogicalName, toUserGuid) } 
       }, 
      DirectionCode = true 
     }; 

     var emailId = organizationService.Create(email); 

     var sampleAttachment = new ActivityMimeAttachment() 
     { 
      ObjectId = new CrmEntityReference(Email.EntityLogicalName, emailId), 
      ObjectTypeCode = Email.EntityLogicalName, 
      Subject = "File attached from sharepoint", 
      Body = Convert.ToBase64String(new byte[] { }), //replace the bytes with the file bytes read from SharePoint 
      FileName = "sharepointattachment.txt" 
     }; 

     organizationService.Create(sampleAttachment); 

     var sendEmailMessageRequest = new SendEmailRequest() { EmailId = emailId, IssueSend = true }; 
     var sendEmailResponse = (SendEmailResponse)organizationService.Execute(sendEmailMessageRequest); 
+0

ありがとうございます!この作品が私のために働くかどうかをお知らせします:) – priyeshwagh777

関連する問題