Hi All
I setup a (SharePoint) document type in Dynamics. When user create new Purchase Order, user will add file(s) to attachments (SharePoint).
New we need a customization, to send email to vendor with attachment(s). So, we need code to download file(s) from SP attachment and send email to Vendor.
However, when I use below code
"url = DocumentManagement::getAttachmentPublicUrl(docuRef)"
The URL is too long because it is URL+token. when I use this URL, I can navigate to.
new Browser().navigate(url, DocuSharedParameters::isOpenAttachmentsInNewWindowEnabled(), false); // success
but I will get error in
_client.DownloadFile(url,docuValue.FileName + '.' + docuValue.FileType); // Failed because string is to long.
I also tried this one
JfileStream = DocumentManagement::getAttachmentStream(docuRef);
but when I set JfileStream in email parameters, I will get error again.
messageBuilder.addAttachment(JfileStream, docuValue.FileName + '.' + docuValue.FileType);



Does anyone has idea about how to download file from SP (attachment) and send with email?
Best Regards,
JustZM