Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

profile() only accepts properties from UserProfileProperties #40

Closed
YakQin opened this issue Dec 12, 2018 · 4 comments
Closed

profile() only accepts properties from UserProfileProperties #40

YakQin opened this issue Dec 12, 2018 · 4 comments
Labels
design Library design issues user/user-profile `user()` and `user().profile()` issues

Comments

@YakQin
Copy link

YakQin commented Dec 12, 2018

To implement the enhancement in #38 you have made changes to sprLib.user(options).profile(). Now it seems we cannot provide any Properties from Person Properties like 'DirectReports', 'DisplayName' etc

sprLib.user(options).profile('DirectReports') -->this is not working, error: DirectReports"DirectReports property does not exist in SP.UserProfiles.PeopleManager.UserProfileProperties"

sprLib.user(options).profile('Department')-->this is working fine, 'Department' is part of the UserProfileProperties

@YakQin
Copy link
Author

YakQin commented Jan 1, 2019

i saw this has been fixed in the latest (26th Dec 2018) build

@YakQin YakQin closed this as completed Jan 1, 2019
@YakQin YakQin reopened this Jan 1, 2019
@YakQin
Copy link
Author

YakQin commented Jan 1, 2019

if the property is an array like below ones, we cannot put it in like profile('DirectReports')

DirectReports
ExtendedManagers
ExtendedReports
Peers

error:
ExtendedManagers"ExtendedManagers property does not exist in SP.UserProfiles.PeopleManager.UserProfileProperties"

@gitbrent
Copy link
Owner

gitbrent commented Feb 3, 2019

Hi @YakQin

I see what you're saying, and it did indeed used to work differently.

However, when a UserProfile property name is provided, it's used in a specific query to UserProfile:

SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(propertyname='SomeProp')

Therefore when using another top-level property name (ex: 'DirectReports') zero returns are returned - as it doesn't exist.

So the fix for your issue would be that the code would have to be aware of which ProfileProperties are "genuine" values so we could query all UserProfileProperty values and filter the one being searched for, which is an ugly solution.

Long story short, I'd prefer users to pull all profiles, then select the [key] they want if it's not a real UserProfileProperty... e.g.: everything not highlighted:

screen shot 2019-02-03 at 17 06 53

@gitbrent gitbrent added design Library design issues user/user-profile `user()` and `user().profile()` issues labels Feb 3, 2019
@YakQin
Copy link
Author

YakQin commented Feb 7, 2019

noted, thanks a lot

@YakQin YakQin closed this as completed Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
design Library design issues user/user-profile `user()` and `user().profile()` issues
Projects
None yet
Development

No branches or pull requests

2 participants