Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

How to upload file with custom services

(1) ShareShare
ReportReport
Posted on by 16

 

I have any type of file to upload using Custom Service.

I need to upload this file to D365FO via a Custom Service call.

I am wondering how we pass the file to the custom service.  What would be the data type? 

 

I have tried with different parm data types like (System.Byte[]  , System.IO.Stream, StreamIo) and passed to my method that accesses the file from Postman but the same error was found after sending the request.

 

my custom service class mehod is >

 public str uploadAttachment(System.Byte[]  _file)
    {
        str result;
        try
        {
            if(_file)
            {
                result =/file read/;
            }
            else
            {
                result =/file not read/;
            }
        }
        catch
        {
            return result;
        }
        return result;
    }
 
sent request and the postman error is >
 
 
Need help ..... how I can achieve this?
 

 

  • Martin Dráb Profile Picture
    Martin Dráb 230,488 Most Valuable Professional on at
    How to upload file with custom services
    Moved from Dynamics AX forum.
     
    Is your requirement using the JSON-based endpoint? Would using a Base64-encoded string be an option for you?
     
    By the way, it sounds like a continuation of the discussion in Post and update person image with custom services in x++.

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,791 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,488 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans