Hello,
I have to send an email with attached files. In fact, these attached files are documents attached to a record through DocuRef. I have already done this type of development several times without any problem, but when the document is hosted in SharePoint it does not work:
The code is this:
SysMailerMessageBuilder addPrintCerticateDocs(SysMailerMessageBuilder _messageBuilder)
{
DocuType docuType;
DocuRef docuRef;
System.IO.Stream docuRefStream;
filename fileName;
while select docuRef
where docuRef.RefTableId == inventBatch.TableId
&& docuRef.RefRecId == inventBatch.RecId
{
docuType = DocuType::find(docuRef.TypeId);
if (docuType.PrintCertificate == NoYes::Yes)
{
docuRefStream = DocumentManagement::getAttachmentStream(docuRef); // Here retrieves Data stream
if (docuRefStream.Length > 0)
{
filename = ‘Not important’;
_messageBuilder.addAttachment(docuRefStream, filename);
}
}
}
…..
The issue occurs when the DocuType associated with the DocuRef is hosted on SharePoint. In other cases it works fine.
It doesn't retrieve anything in the data stream and when trying to access its content:
A couple of things:
- I think, although I could be wrong, that it is not a security problem since the code has been executed by a person administrator of "everything"
- I have done the test of attaching exactly the same document, one hosted in Azure and another in SharePoint and in the first case everything is fine and in the second case, error
Any ideas?
Excuse my poor level of English
Thanks in advance
Carlos

Report
All responses (
Answers (