Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
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 Super User 2024 Season 1 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 Super User 2024 Season 1 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans