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)

Path returned by docuref is not accessible

(0) ShareShare
ReportReport
Posted on by

hello,

i'm trying to combine all the pdf attached in a record but i can not access the path returned from docuref through x++ the stattement am using is 

"docuref.completefilename() ;"  the problem is in this line " reader = new iTextSharp.text.pdf.PdfReader(file);" clr object could not be created

i think aos don't have access to this path because if i changed like this it works 

"reader = new iTextSharp.text.pdf.PdfReader(@"C:\Users\usr\Desktop\test.pdf")

*This post is locked for comments

I have the same question (0)
  • Catalyst619 Profile Picture
    355 on at

    How are you initializing your file object? If you create a docuref reference to the same PDF on your desktop, what is the path value of your file object when you debug?

  • Community Member Profile Picture
    on at

    file = docuref.completefilename() ;

    // the file path is this when i debug "C:\Users\usr\AppData\Local\Microsoft\Windows\INetCache\test.pdf" but i don't find test.pdf in this location "C:\Users\usr\AppData\Local\Microsoft\Windows\INetCache\"

    document.Open();

    reader = new iTextSharp.text.pdf.PdfReader( file);...............

  • Verified answer
    Catalyst619 Profile Picture
    355 on at

    2018_2D00_05_2D00_23-10_5F00_29_5F00_58_2D00_192.168.1.17-_2D00_-Remote-Desktop-Connection.jpg

    When you attach a new document to your record, is the file path in this field the exact same path you've listed? 

    C:\Users\usr\AppData\Local\Microsoft\Windows\INetCache\

    Typically, one would setup a path for their documents here:

     Organization administration > Setup > Document management > Document management parameters.

    If you look in the archive directory field, you can specify a path there. Create a custom path that you have access to and try re-attaching your document. It should go to the path you've specified, and you should be able to physically see and open your PDF from that location.  Since you can't see your PDF in that location, your reader won't be able to as well.

    Once you've configured the directory and have access to your file, your reader should be able to do the same.

  • Community Member Profile Picture
    on at

    Thank u aleks , this is new for me !

    but the file name is not the same path that i have specified !!

    what can be the prob ?

  • Verified answer
    Catalyst619 Profile Picture
    355 on at

    You'll need to play around with the configuration until you can save your files reliably in the directory that you expect/have provided. If I attach a file from my desktop, AX will make a copy of that file and save it under the directory that I have specified under document management parameters.

    After you've changed the configuration to your new directory, create a new order/transaction/whatever it is that you're attaching your PDF to and make the attachment again. It won't change the path for previous attachments.

    That is the same directory that you should be able to see in SQL, as well as the return value from calling the

    docuref.completefilename() method. Your code is fine, as I've just done the same thing and was able to retrieve it successfully.

    Feel free to mark the answer as verified if it's been helpful and you're on the right path to configuring your DocuRef path.

  • Community Member Profile Picture
    on at

    Thank you alesks i will do this

  • Community Member Profile Picture
    on at

    one more thing plz aleks ,

    if i want that the location of the attachement is the database not the archive direcrory !!! how can i achive my requirement !

  • Catalyst619 Profile Picture
    355 on at

    With my personal experience with merging PDF's, I would use the WINAPI class to create a temp folder and move my required files there. I would then create a container with a reference to all my files and merge them via the PDFSharp library.

    If your business requirements allow it, my recommendation would be to do something similar.

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