Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Can't download an attached file using DocuRef.documentId x++

(1) ShareShare
ReportReport
Posted on by 8
When I used DocumentManagement::getAttachmentPublicUrl to get the url of a file and tried to open the link (<D365FO>/displayUrl) I get this screen
 
the job code that i tried and got also got the same screen is:
 
 
DocuRef docRef;
str     displayUrl;
guid    fileGuid = newGuid();
fileGuid = str2Guid(/9F7E5884-6AED-4DD9-A593-877567B16D9C/);   
   
select firstonly docRef
  where docRef.DocumentId == fileGuid;
if(docRef)
{
    displayUrl = DocumentManagement::getAttachmentPublicUrl(docRef);
    info(strFmt(/%1/, displayUrl));
    new Browser().navigate(displayUrl, false, false);
}
 
 
any idea how to solve this?
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 11,560 Super User 2024 Season 2 on at
    Can't download an attached file using DocuRef.documentId x++
    Hi,
    if you have the stream file you can use this 
    str filetmp = File::SendFileToTempStore(stream, fullFileName);
    Best regards,
    Mohamed Amine Mahmoudi
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,883 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,569 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans