Select to view content in your preferred language

Windows user name

404
2
Jump to solution
05-04-2022 07:38 AM
BKSchwarz
New Contributor II

Hello

Does anyone know how I might go about accessing a Survey123 users Windows username?  I am ok with assuming the user will be using Window exclusively.

I am uploading content via the survey's media folder and I'd like to allow the user to be able to open the content.  I have found a solution thanks to a post from @DeonLengton 

HTML Links for Survey123 to just about anything - https://community.esri.com/t5/arcgis-survey123-blog/html-links-for-survey123-to-just-about-anything/...    

However, the one sticking point is that I need to hardwire the Windows username into the path of where the survey stores the content (see below).    

C:\Users\<WindowsUsername>\ArcGIS\My Surveys\bec6a9f59ef347f1aca5089a1a724383\esriinfo\media  

I realize that I could create a text field in the survey to allow the user to enter their username and then use this in the pathname string above, but I'm looking for a solution that does not require their input if possible.

Thanks so much.

BKS

0 Kudos
1 Solution

Accepted Solutions
BKSchwarz
New Contributor II

@DougBrowning I'm afraid I could not get it to work using %USERNAME%.  

So I looked into Excel and the only way to do it is to create a VBA function.  

In the end I decided to make them enter their Windows username as a text field and then inserted ${username} into the pathname.  This worked.  But I was hoping to not have to ask them for their username. 

Thanks Brian

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

I wonder if %userprofile% would work here.  That is how windows handles it.

See https://renenyffenegger.ch/notes/Windows/dirs/Users/username/index 

Hope the helps

0 Kudos
BKSchwarz
New Contributor II

@DougBrowning I'm afraid I could not get it to work using %USERNAME%.  

So I looked into Excel and the only way to do it is to create a VBA function.  

In the end I decided to make them enter their Windows username as a text field and then inserted ${username} into the pathname.  This worked.  But I was hoping to not have to ask them for their username. 

Thanks Brian

0 Kudos