Solved

Office 365 Query User Profile


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-however-the-details-of-the-workflow-shows-invalid-text-value

 

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?

icon

Best answer by pwakefield 19 July 2017, 19:43

View original

19 replies

Userlevel 7
Badge +17

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

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

Userlevel 7
Badge +17

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

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>

Userlevel 7
Badge +17

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

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>

Userlevel 7
Badge +17

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

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>

Userlevel 7
Badge +17

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=User 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

I did see the SPS-Department when I was going through the REST API. So I looked at the properties just now and see 2 Departments. One is mapped to Department and the other is mapped to SPS-Department. I thought maybe I should try a different property that was only one. I chose Job Title that is mapped to SPS-JobTitle. I still received the Invalid Text error.

Also something I thought was odd is that in the property settings, Job Title isn't checked to show on my profile page but it definitely does and showed up in my API query. Does that affect anything?

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>

Userlevel 7
Badge +17

Piper Wakefield wrote:

Also something I thought was odd is that in the property settings, Job Title isn't checked to show on my profile page but it definitely does and showed up in my API query.   Does that affect anything?

No, it doesn't

Piper, would it be possible, that you print-screen your entire "Office 365 Query User Profile" action's configuration?

There must be a misconfiguration there

Regards,

Tomasz

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>

Userlevel 7
Badge +17

I really have no idea what is wrong

Are you sure the property value does not contain any spaces etc...?

Last thing to check - have you granted Nintex permissions to access User Profiles?

(click the gear icon in top-right corner and then the button in the modal window).

Regards,

Tomasz

1. I'm not 100% sure what you mean by no spaces? Should I use SPS-JobTitle and not Job Title?

2. Yes I did but I just did it again....I wish there was a way you could check that it was on? There is no indicator...everytime I check that gear it just asks me to trust it....

Thank you so much for all your help! I'm sorry this one was so weird. We'll probably have to bite the bullet and contact our Nintex partner but I learned some new troubleshooting from this!

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>

Userlevel 7
Badge +17

Piper,

Ad. 1 - I mean to trim the string. No empty characters to be before and after.

Ad. 2 - of course there is Not from the NIntex App directly unfortunately, but if you go to Site Settings --> Site App Permissions there you can find a row indicating trust for Workflow. Or at least I hope it is recorded there  

Back to the beginning - this issue is imho somehow related with your tenant. I don't know for sure, but as I can confirm this mechanism works just fine on mine, I suppose the issue is local. Maybe Nintex Support can assist you.

One more thing - if you try to create a fresh, new workflow, where you have this action - does it work, or does it also show error? Can you create a site workflow at the root site level and check?

Regards,

Tomasz

I did see it in app permissions so...good! Now, I just tried only the query step in a site workflow. Same results so yeah I think something is up with our tenant or I genuinely am configuring it wrong but we can't see it.

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>

Userlevel 7
Badge +17

I'm really totally out of ideas ‌ is there anything else we are missing here?

Regards,

Tomasz

Wanted to follow up that I contacted Nintex and they were able to see it was a permissions issue.  I really wish that was what the error message was and not invalid text.  Sounds like the account making the query was able to get into the tenant but not able to query once it was inside (*which is weird*).  Unfortunately,  we tested every level of access for a service account and the only way we could get it to work was to set it as Global Admin (*which is very atypical*).  I never got a straight answer of what the minimum permissions for the Query Profile step should be.  Nintex told me to check with Microsoft. 

TLDR: It works but the permission ended up being God-level which shouldn't be necessary but seems to be for our environment until further notice....

Thank you so much everyone for helping me troubleshoot!  I learned lots!

Is this the error you were receiving?

Reply