Downloading a file on execution VM

hi ,

i developed a process to download a file from sharepoint

i gave the path as c:\users\environment.username\document\SharePoint\fileName on local
SharePoint FOLDER I CREATED under documents on vm

its working fine ON LOCAL

how make this work on robot as its failing with error cannot find path
c:\users\LOCAL SERVICES\document\SharePoint\fileName

@mint,

Use this in assign activity:
"c:\users\"+Environment.UserName+"\document\SharePoint\fileName"

Environment.UserName will give you user name.

image

Thanks,
Ashok :slight_smile:

@ashokkarale Thanks i used Envirnment.username but its failing
seems there is some change as when i am executing the script its coming as NT AUTHORITY\LOCAL SERVICE as host identity

@mint,

Is your process background process? In that case follow this Host id is changing when i run in unattended mode - #3 by marian.platonov

Thanks,
Ashok :slight_smile:

1 Like

yes it is background automation

@mint

background automations by default run under local host so the username would be local users as you are getting in environment.Username

in this scenario use generic locations like c:\Botfolder\ which you can check and create if not available in the process itself

cheers

@Anil_G should i create a folder under c: drive asshare point folder and then will i will be able to download and add that file as an attachment ?

@mint

if you just need to download and attach…then better use Path.Combine(environment.CurrentDirectory,"Filename")

even the same thing can be done using c drive folder as well.

then you can attach from there as well

cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.