Html web page Relevance code error for image display

Hi, i am looking checking a file into a directory path and would like to provide the username as relevance code parameter due to user name can be dynamic , i am trying to use the below code but it is not running ,

please suggest

q:if exists true whose (if true then exists logged on user else false) then names of logged on users else if exists current user then name of current user else ""
A: user1
T: 1.737 ms

q: exists file “C:\Users” and (“if exists true whose (if true then exists logged on user else false) then names of logged on users else if exists current user then name of current user else “””) and "\AppData\Local\Microsoft\Office\16.0\Lync\sip_user1@test.com\Photo\sip_user1@test.com.cache"
E: This expression could not be parsed.

You are using the logical “and” operator which expects clauses like “true AND false”. You want the string concatenation operator “&”. You should also wrap the filename in ()

exists file ("c:\users" & something & the rest)

It is not working , can you please check if i missed out any thing

q: exists file (“C:\Users” & “if exists true whose (if true then exists logged on user else false) then names of logged on users else if exists current user then name of current user else “”” & “\AppData\Local\Microsoft\Office\16.0\Lync\sip_user1@test.com\Photo\sip_user1@test.com.cache”)
E: This expression could not be parsed.

Since you have quotes around it, that whole thing is a string - so you’re looking for a folder under C:\Users that starts with “if exists true”
Build all of those as separate terms first before combining them

I think you should evaluate whether you need logged on user AND current user.

Current user is a subset of logged on user; see relevance references for the former and the latter.

In other words, by looking for “logged on user” you are also looking for current user.

Now, that being said you can further reduce the complexity of your query by just ignoring the logged on users and and use plurality to iterate through all user folders.

Q: exists files "filename" of folders "foldername" of folders of folders (name of drive of windows folder & "\users")

This will look through all folders under the systemdrive:\Users\whateveryourpathis\whateveryourfilenameis.extension.

Keep in mind that any user based inspection relies on the user being logged on, which means the data will be transitory. Depending on what you’re using this data for you would most likely do better by inspecting all of the user folders instead, or alternatively only looking if a single user is logged on.

EDIT:
Here’s a sample of the latter relevance that only inspects if a single user is logged on, locally or remotely, and returns nothing if more than or less than 1 user is logged on:
if number of logged on users = 1 then exists files ("C:\Users" & name of logged on user & "\AppData\Local\Microsoft\Office\16.0\Lync\sip_user1@test.com\Photo\sip_user1@test.com.cache") else nothing

Hi, actually i am trying to put logged on user photo in the web page and using below code, that’s why i am trying to pick the current user name on the below path

Not working

<img src=“C:\Users\ <?relevance if exists true whose (if true then exists logged on user else false) then names of logged on users else if exists current user then name of current user else "" ?> \AppData\Local\Microsoft\Office\16.0\Lync\sip_ <?relevance if exists true whose (if true then exists logged on user else false) then names of logged on users else if exists current user then name of current user else "" ?> @ <?relevance if (exists wmi) then (string values of selects "Domain from Win32_ComputerSystem" of wmi) else ("N/A") ?>\Photo\sip_Administrator@ <?relevance if (exists wmi) then (string values of selects "Domain from Win32_ComputerSystem" of wmi) else ("N/A") ?>.cache” style=“float: left;margin: 31px 15px 0 0;border-radius: 50%;width:150px;height: 150px;border: 2px solid #ddd;”>

Notebook: Windows 10X64 10.0

Working

So what do you do if there are multiple users logged in?

And what web page are you trying to “put logged on user photo in”?

So what do you do if there are multiple users logged in? - I assume laptop user will be single logging at a point of time.

And what web page are you trying to “put logged on user photo in”? There is a custom web page which are building under SSA to automate the software deployment for the laptop user and that web page should display the image of the user if it is set under the mentioned directory.

So my concern is when i try to use relevance code then there is no image display but when i use static path it shows the photo.

That’s not an assumption I would personally make…

That being said, did you try
if number of logged on users = 1 then exists files ("C:\Users" & name of logged on user & "\AppData\Local\Microsoft\Office\16.0\Lync\sip_user1@test.com\Photo\sip_user1@test.com.cache") else nothing

q:if number of logged on users = 1 then exists files (“C:\Users” & name of logged on user & “\AppData\Local\Microsoft\Office\16.0\Lync\sip_user1@test.com\Photo\sip_user1@test.com.cache”) else nothing

A: False
T: 2.832 ms

Soo… no logged on user?

EDIT:
Scratch that. The file doesn’t exist… I made some assumptions about the name of the file and the folder; double check that my assumptions were correct…

I used this time c:\User\ and getting value true, now want to give try the code into my html file

q:if number of logged on users = 1 then exists files (“C:\Users\” & name of logged on user & “\AppData\Local\Microsoft\Office\16.0\Lync\sip_user1@test.com\Photo\sip_user1@test.com.cache”) else nothing
A: True
T: 1.568 ms

It is not working on html page :frowning:
<img src=“C:\Users\sklocal\AppData\Local\Microsoft\Office\16.0\Lync\sip_sklocal@” & if (exists wmi) then (string values of selects “Domain from Win32_ComputerSystem” of wmi) else (“N/A”) & “\Photo\sip_sklocal@vijay.local.cache” style=“float: left;margin: 31px 15px 0 0;border-radius: 50%;width:150px;height: 150px;border: 2px solid #ddd;”>

Notebook: Windows 10X64 10.0

What does that relevance return by itself?

actually i am trying to get the domain name , however it could be different from the actual file name in prod , but this code i am using for testing purpose as all files are in photo directory having domain name as well by default

q: if (exists wmi) then (string values of selects “Domain from Win32_ComputerSystem” of wmi) else (“N/A”)
A: vijay.local
T: 34.733 ms

You can’t typically put a plural into a string value.

In this case you have to do:
Q: "C:\Users\sklocal\AppData\Local\Microsoft\Office\16.0\Lync\sip_sklocal@" & (string value of selects "Domain from Win32_ComputerSystem" of wmi) & "\Photo\sip_sklocal@vijay.local.cache"

Otherwise, to use the plural “string values” you have to do:
Q: ("C:\Users\sklocal\AppData\Local\Microsoft\Office\16.0\Lync\sip_sklocal@" & it & "\Photo\sip_sklocal@vijay.local.cache") of (string values of selects "Domain from Win32_ComputerSystem" of wmi)

Ok, i am trying to make the code simple and trying with logged in user name only this time but it does not display image

<img src="C:\Users" & name of logged on user & “\AppData\Local\Microsoft\Office\16.0\Lync\sip_sklocal@vijay.local\Photo\sip_sklocal@vijay.local.cache” style=“float: left;margin: 31px 15px 0 0;border-radius: 50%;width:150px;height: 150px;border: 2px solid #ddd;”>

Notebook: Windows 10X64 10.0

q:“C:\Users” & (name of logged on user) & "\AppData\Local\Microsoft\Office\16.0\Lync\sip_sklocal@vijay.local\Photo\sip_sklocal@vijay.local.cache"
A: C:\Users\sklocal\AppData\Local\Microsoft\Office\16.0\Lync\sip_sklocal@vijay.local\Photo\sip_sklocal@vijay.local.cache
T: 1.288 ms

Looks like you’re missing a trailing slash to me.

Wouldn’t you also need to specify a filename? You’ve got the path that ends in .cache, but I would have figured you’d need a filename.extension or something.

i m using “” with users somehow it is not displaying while coping here in the forum window , and the file is with .cache extension which the default method of microsoft saving image file of the users in outlook