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 :
Microsoft Dynamics AX (Archived)

send pdf or word file to c# service

(0) ShareShare
ReportReport
Posted on by

hi,

i want to send word or pdf file generated from x++ code  to send  c# service  . can you help me with this .

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    I assume you want to send the file from AX to an external WCF web service. Is that correct?

    If so, the language used to develop the service isn't important.

    Then I would use a byte array. although you could also encode your binary data (making up the file) to a string.

  • Community Member Profile Picture
    on at

    yes , i want to use  byte array .  but how to get byte array  for  word  file , that is Com Object . it is not stored in database at that moment .

  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    I thought you had a file. A COM object clearly isn't the same thing as a file. If you have access to the file, just forget the COM object and work with the file directly. If you have to work with the COM object (e.g. because you're making some changes), can't you simply save it to file?

    When you have a file, the easier way is calling System.IO.File::ReadAllBytes(). Of course, it means reading the whole file to memory, which isn't optimal, but it may be good enough for your scenario. You can do it better with streaming, but I didn't want to make it too complicated from the very beginning.

  • Community Member Profile Picture
    on at

    i am generating a word file   from code  with  dotx system  draft resource . i want  this file  sent to c# service .  i can  get   bindata  from  file  that is stored  in some location , on server  , but  my main goal is to get bin data of the file after i generate it  from  dotx  file and fill it with bookmarks .  

    i guess i need  to  store this file on temporary location , and delete  file  afterwards . i am  trying to use WinApi::getTempPath())  now  and save  file  to this location. then  get  file  from this location  and  therefore ,  get  bindata .   i  dont want  to save  file  on database or on file server .

  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    You can use System.IO.Path::GetTempFileName().

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans