web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Fetching user temp folder

(0) ShareShare
ReportReport
Posted on by 120

Hi All,

I am working on AX 2012, I am trying to fetch the temp folder path using System.IO.Path::GetTempPath(). when I use this in a job, I fetch the temp folder of logged in user but when I use this in controller class, I fetch the temp folder of AOS user. My developer options "execute business operations in CIl" is turned off. Is there a way that I can get the logged in user temp folder in Controller classes?

*This post is locked for comments

I have the same question (0)
  • Vgubba Profile Picture
    120 on at
    RE: Fetching user temp folder

    Thank you very much for your answers. The basic requirement was to attach a zip file to email with some details when RFQ is sent to vendors.

    the RFQ by standard is created in temp folder and attached to email, we are using the same folder to put the additional zip file attachment and attach this in the email, but we had a performance issue because the same zip file was being created per vendor. I wanted to customize this to generate a zip file in temp folder only once and use this for all vendors in the RFQ case.

  • Suggested answer
    Martin Dráb Profile Picture
    235,959 Most Valuable Professional on at
    RE: Fetching user temp folder

    What you see is the correct and expected behavior. The client process is executed by the user while the AOS runs under the AOS service account.

    Also note that AOS usually runs on a different machine than where users log in, therefore what you ask for would require AOS to identify the client computer, connect there, find the temp folder for the users - and have permissions to write there (which is unlikely and it wouldn't make sense from security perspective).

    If you want AOS to generate files that users can access, you probably should put them to a shared network folder. An alternative solution would be generating the file on server, then transfering it to the client process and execute code on client to put the file on disk there.

    If you tell us what business problem you're trying to solve, we might be able to give you more specific suggestions.

  • Suggested answer
    feelyd Profile Picture
    260 on at
    RE: Fetching user temp folder

    The location of TEMP folder is defined in Windows environmental variables.

    So it would be something like  %USERPROFILE%\AppData\Local\Temp.

    As the user is running the controller through the AOS , you would always get the AOS users temp location.

    The job runs on the client so it would return the clients temp folder.

    If you want to store something based on a user. you could just create a file path using the logged in users name.

    Passing this code into the controller

  • Vgubba Profile Picture
    120 on at
    RE: Fetching user temp folder

    I have used WinAPI::getTempPath(), I want to know if this is right or any other possible solutions

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Community Member Profile Picture

Community Member 2

#2
Mea_ Profile Picture

Mea_ 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans