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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

CRM API returns internal server error 500 while fetching 90mb document

(0) ShareShare
ReportReport
Posted on by 10

Hi Experts,

Using CRM web api to retrieve the documentbody from annotation, looking to retrive bigger files till 128MB, but getting internal server error 500 for file around 90 MB, able to response for files around 70mb

Can you please help if i am missing something here

Here is the code

string getRequest = "api/data/v9.0/annotations("+ noteId + ")?$select=filename,filesize,documentbody";
                string baseaddrr = "">myorg.crm.dynamics.com/";
                httpClient.BaseAddress = new Uri(baseaddrr);
                httpClient.Timeout = new TimeSpan(0, 8, 0);
                httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0");
                httpClient.DefaultRequestHeaders.Add("OData-Version", "4.0");
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.Add("Prefer", "odata.include-annotations=OData.Community.Display.V1.FormattedValue");
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", result);
                var responseMessage = await httpClient.GetAsync(getRequest).ConfigureAwait(false);

                //HttpResponseMessage responseMessage = t.;

                if (responseMessage.IsSuccessStatusCode)
                {
                }
  • Suggested answer
    LeoAlt Profile Picture
    16,341 Moderator on at

    Hi partner,

    According to the documentation of Annotation web api, the max length of document body is 1073741823 which could also be thought of 1GB.

    pastedimage1585792585963v1.png

    And your code also has no limits on file size, so I recommend you to raise a ticket to Microsoft for more professional help.

    You could also try the following ways.

    1.Try "ActivityMimeAttachment" to get files.

    2.Use Annotation  method to get Annotation objects.

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/sample-upload-retrieve-download-attachment

    Sample code:

    https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/URDAttachement/URDAttachement

    Hope it helps.

    Best Regards,

    Leo

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 42

#2
11manish Profile Picture

11manish 31 Super User 2026 Season 2

#3
Travis South Profile Picture

Travis South 25

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans