web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to programmatically download attachments in notes

(0) ShareShare
ReportReport
Posted on by 50

Does anyone know how to pragmatically download attachments from Opportunity notes? I have been able to download and upload to SharePoint any EMBEDDED attachments stored in msdyn_fileblob, but if it is a direct attachment stored in annotations documentbody, it is not in the same file format. I am not familiar with how to convert this into a text/plain fileblob format I can upload to sharepoint.

Working on a script to migrate all notes to SharePoint and update opportunities with hyperlink to document (space savings).

I have the same question (0)
  • Verified answer
    Levi Stevens Profile Picture
    50 on at

    Solutions was following:

    $fileblob = [System.Convert]::FromBase64String($documentbody)

    $upload = Call-WebAPI -URI "$mgurl/drives/$PDR_RootID/root:/$locationurl/$($fileName):/content" -Method PUT -Accept "text/plain" -Authorization $Token2 -Body $fileblob -ContentType 'text/plain'

    Using the content type 'text/plain'.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans