Hi, I am using the Path Exist activity and have the activity working. I however, need to make the code work for any computer, I have figured the username to change according to the pc. However, the file is going to be in a OneDrive and at the moment the file path has the unique onedrive account, is there a way to indicate one drive in general so that any pc with whatever account in one drive is there, its like in selector you put an asterisk. The 00000 after the One Drive is going to change according to the pc, is there a way to make it so it works on any one drive account?
Perhaps using an Assign-Activity works for you, where you assign i.e.
str_Username= System.Environment.UserName
Similar cases could help you resolve your issue. However, depending on how OneDrive is set up on each device, it’s not 100 % guaranteed that you’ll find the right target/destination with this method.
You may want to verify with i.e. the “Path Exists” (File exists is included there) to apply some Exception Handling.
Hi all, I tried your suggestions and unfortunately they didnt work. Maybe I didnt phrase the questions correctly. But I would like to find a way to assign whatever the One Drive Account is called. Is there a way to access the name. E.g the red line
Hi @FilipeChiou ,
You can use the below code to get the path to the my documents folder from that you can extract the one drive portion using string operations.
Instead of hardcoding the OneDrive folder name (which changes per user), you should use the OneDrive environment variable to get the correct path dynamically. This way, it will work on any machine and account without worrying about the “OneDrive - Company Name” part.