Attachment Preview does not work in PR


We are running into an issue of opening the attachments from the PR after our production was updated to self-service last night. The weird thing is this is only an issue with the PR created using integration (logic apps) and is affecting both current and historical PR attachments.

Preview pane shows blank with error ‘error opening document’ and XML style message.

If the PR is created directly in D365 then it shows attachment without any issue.

Does anyone know where I should start looking for this issue?

We already have a SEV A ticket with MS open but since this is happening with only Integration they are saying it is custom and not much help at all.

Thank you.

that’s likely something microsoft is going to have to address. we haven’t run into any issues like that yet, but we’ve seen some other strange things that happen during the self-service update, so im not 100% surprised. please update this post when you find out what the issue is - i’m really curious.

Still trying to figure this out. After some testing we now know that images are coming through, getting error when trying to open Word document but at least it knows its a word document, word opens and then errors out in preview and pdf’s are giving out error. So might be filetype disassociation somewhere?

What MIME type are you setting from Logic Apps?

If you use DocuFileAction.attachFile(), for example, MIME type is the third argument (_fileContentType).

Hi Martin,

Logic Apps is actually saving the information and attachment to the custom table called TransferAttachment and then there is a helper class which moves the document from the table to docref.

Below is the part of the code:

private static DocuRef insertAttachmentWithFile( )
System.Byte[] reportBytes;
DocuRef docuRef;

reportBytes = System.Convert::FromBase64String(TransferAttachment.FileContent);

System.IO.MemoryStream stream = new System.IO.MemoryStream(reportBytes);

PurchReqTable purchReqTable = PurchReqTable::findPurchReqId(TransferAttachment.PurchReqId);
docuRef = DocumentManagement::attachFile(purchReqTable.TableId,
return DocuRef;

Your code uses the value of transferAttachment.FilenameType. To answer my question, you need to find out how your Logic Apps sets FilenameType, or what you actually have already stored in the storage.

By thw way, please use Insert > Insert Code to paste source code. It preserves indentation.

Thanks Martin,

I will remember that.

UPDATE: Other microsoft customers have started complaining about the same issue after update to self-service. They are seeing some invalid file types in the Azure storage and MS document management engineers are working on resolving this issue.