pwakefield
Novice

Office 365 Query User Profile

Jump to solution

I have been searching through the forums and I see very few examples of the Query User Profile.  I have the same problem as this question with the Invalid text error: https://community.nintex.com/thread/15850-user-profile-action-failing-workflow-status-show-started-h...

But I think I have avoided some of the common configuration pitfalls I have seen: wrong tenant URL and ensure you are looking up email address.

I am setup as a Site Collection Admin and am trying to query myself to ensure I have everything setup right...the only thing I can think of is that I don't have access to query users?  How would I know if I have access to query or not?

Reply
19 Replies
TomaszPoszytek

Re: Office 365 Query User Profile

Jump to solution

Hi!

So it seems your configuration is indeed correct. Be sure you are querying for the user profile attribute that actually exists in your users' profiles. Start on querying your profile. Type this after your tenant's URL:

http://<site url>/_api/sp.userprofiles.peoplemanager/getmyproperties

In return you should receive an XML structured data where you can lookup your property. Then check for other user (https://msdn.microsoft.com/en-us/library/office/dn790354.aspx). If it is missing there and is present in your profile, check if it is visible to anybody.

Regards,

Tomasz

Reply
pwakefield
Novice

Re: Office 365 Query User Profile

Jump to solution

I was successfully able to get my properties and the field I was querying did have data in it. But I couldn't figure out how to query another user. I kept receiving this error

I was using the following uri with the

0 Kudos
Reply
TomaszPoszytek

Re: Office 365 Query User Profile

Jump to solution

For the other user you have to escape the login. You do not do it via the email, but login together with a claim:

https://<site url>/_api/sp.userprofiles.peoplemanager/getpropertiesfor(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.com'‍

It really works. Check if you haven't misspelled something

Regards,

Tomasz

Reply
pwakefield
Novice

Re: Office 365 Query User Profile

Jump to solution

Great that worked! I see the Department element in mine and the other user. Now what?

Are you suggesting I don't use the Query Workflow step and use the Call HTTP Web Service???

Piper Wakefield

Applications Support Specialist

Oswald Companies

1100 Superior Avenue, Suite 1500

Cleveland, OH 44114

Phone 216.367.3297

Fax 216.367.4520

pwakefield@oswaldcompanies.com<mailto:pwakefield@oswaldcompanies.com>

0 Kudos
Reply
TomaszPoszytek

Re: Office 365 Query User Profile

Jump to solution

You can try to use "Web Request" action instead of "Office 365 Query User Profile" however I have no idea why that action don't work for you. What error are you getting once executing the action? Can you log to history the "txtDepartment" variable after the action is executed? Does it contain anything?

Regards,

Tomasz

Reply
pwakefield
Novice

Re: Office 365 Query User Profile

Jump to solution

I did try that but the workflow doesn't seem to get that far. I think it stalls before it can get to the Log Step unless I am doing something wrong

Piper Wakefield

Applications Support Specialist

Oswald Companies

1100 Superior Avenue, Suite 1500

Cleveland, OH 44114

Phone 216.367.3297

Fax 216.367.4520

pwakefield@oswaldcompanies.com<mailto:pwakefield@oswaldcompanies.com>

0 Kudos
Reply
TomaszPoszytek

Re: Office 365 Query User Profile

Jump to solution

If you log a message before the action is it visible in history?

Maybe try setting the "Department" as a text variable and then provide the text variable instead of a plain text in your Office 365 Query User Profile action.

Regards,

Tomasz

0 Kudos
Reply
pwakefield
Novice

Re: Office 365 Query User Profile

Jump to solution

Yes it does show messages before the query. Stalled message is the same. I set txtDepartment to be Department (and spit it out to a message just to confirm it had something in it) and then made a new variable for the output called txtDepartmentResult. Is that what you meant?

Piper Wakefield

Applications Support Specialist

Oswald Companies

1100 Superior Avenue, Suite 1500

Cleveland, OH 44114

Phone 216.367.3297

Fax 216.367.4520

pwakefield@oswaldcompanies.com<mailto:pwakefield@oswaldcompanies.com>

0 Kudos
Reply
TomaszPoszytek

Re: Office 365 Query User Profile

Jump to solution

Yup exactly. This is odd.

I tried the same thing on my tenancy, I nominated AlexW to be Site Collection admin, I created a short workflow:

and configured it accordingly:

And voilla: I have the department in the log:

What URL of the tenant are you providing? With "/" at the end or without?

I thought before I attempted to recreate your case, that maybe the fact, that there are 2 "Department" properties:

  • Department
  • SPS-Department

could mess something, but that was not the case. I suggest you to go to "Manage User Properties" https://[tenant]-admin.sharepoint.com/_layouts/15/tenantprofileadmin/MgrProperty.aspx?ProfileType=Us... and check the internal name of your "Department" property. Maybe it is not that straightforward?    

BTW: I changed the "Department" value in the AdeleV profile to a different one than "SPS-Department" has and I can confirm, that the field with the "Department" internal name was queried.

Regards,

Tomasz

Reply