Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Unanswered

How to attach file file while creating a record in Dynamic 365 using Web API

Posted on by 15

I am using Dynamic 365 Web API for creating a record using Mobile App. Everything is working fine, but I am stuck on uploading a file using the web API. I have gone through this link https://docs.microsoft.com/en-us/powerapps/developer/data-platform/file-attributes. and tried using the method mentioned, but still, it is not working.

Please help!!

  • Devender Adlakha Profile Picture
    Devender Adlakha 15 on at
    RE: How to attach file file while creating a record in Dynamic 365 using Web API

    Hi Charan Raju

    I am using POSTMAN and sending a PATCH request on

    yourdomain.api.crm8.dynamics.com/.../s36000_ic

    with the following headers{

    x-ms-file-name:ic.png,

    x-ms-transfer-mode:chunked

    }.

    after this request is triggered I get a location variable from the response header and again I am making a PATCH request on this:

    yourdomain.api.crm8.dynamics.com/.../s36000_ic

    with the following headers

    {

    Content-Range : bytes 0-33554431/*

    Content-Type : application/octet-stream

    x-ms-file-name : ic.png

    Content-Length : 10737456

    }

    but still, i am getting an error

  • Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Moderator on at
    RE: How to attach file file while creating a record in Dynamic 365 using Web API

    Hi Devendar,

    Could you please post your code here?

  • Devender Adlakha Profile Picture
    Devender Adlakha 15 on at
    RE: How to attach file file while creating a record in Dynamic 365 using Web API

    Hi Charan Raju C R

    I am storing data at 2 Places, first, I am making a post request on to my server and uploading the image into the database by converting it into the base64 format.

    now when my base64 string is stored in the database I am using the dynamics 365 web API for file upload.

    my backend API's are created in laravel and from laravel I am using HTTP::Patch Request with bearer token.

  • Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Moderator on at
    RE: How to attach file file while creating a record in Dynamic 365 using Web API

    Hi Devender,

    How are you uploading the file? Using HTML webresource to browse and select the file for uploading from mobile device?

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans