Solved

Correct environment variable for user's documents folder in all situations

  • 10 October 2023
  • 3 replies
  • 427 views

Userlevel 4
Badge +13

Our users are logged in through various methods. Some have managed systems, others log in via RDP. Sometimes a user has their files synced with Onedrive, others have a profile folder on a shared drive via redirection. This leads to reports with export to pdf setting being saved in various locations.

For a process flow we were able to program one of these file paths by putting a username variable as part of the path but this renders the flow unusable for quite a few of our users. The flow uses a move file action but it often can't find the exported pdf file. Therefor we need a more generic approach.

What folder does the export to pdf option use internally to determine where to save a file? I've tried %USERPROFILE%\Documents but already in my own case this leads me to the wrong folder.

icon

Best answer by Erik de Roos 6 November 2023, 12:24

View original

This topic has been closed for comments

3 replies

Hi Roland,

I’m Erik from the windows gui support team. I will try to help you as good as possible, given the information you provided us with.

 

My first thought was to add a PATH variable to all the machines, and use a startup script on these machines to get an environment specific in this path. So that the end result is a ‘generic’ path. You can then use this path in your proces flow as a uniform storage and retrieval method.

This method relies on the assumption that all the machines the windows GUI is installed on are on a domain that you have control over and you can control the startup scripts for them.

 

However, you specifically mentioned using OneDrive.

A colleague pointed out that there is a known issue with OneDrive, and you might want to take a look at that first. OneDrive maps specific user preference folders away from their default locations by using the windows registry.

In the situation this colleague referenced to, it was the ‘%USERPROFILE%\Desktop’ folder. The issue here was that if you browsed to this folder explicitly it did still exist but if you look at the content, it is not the same as if you looked at your desktop. To me and my colleague, your last sentence sounds a lot like you experience a similar issue.

If this is the case, you can undo this by changing how you install OneDrive. 

If that is not possible, you might want to google the following solution. With this solution, we are again creating the previously mentioned PATH with script. In this script you the need to do some logic. That logic is that you find the following key in registry [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal] and use the content of this key for your ‘generic’ PATH variable.

 

I hope this gives you something to work with. And please share your findings (or your solution) here.

Userlevel 5
Badge +8

Hi @Roland,

Can you please respond to Erik his comments, were these sufficient? 🙂

@Jeroen van den Belt , @Roland 

The solution used was adding a PATH variable (via intunes)

Thanks