Closed get2pallav closed 6 years ago
I don't know if I understand your problem correctly, but you are trying to use these methods in SharePoint 2016. I just checked the newest CSOM for SharePoint 2016 and it's definitely there, so it should be exposed in REST too. Just use the newest vesion of PnP-JS-Core - user profile manipulation was added recently.
@get2pallav,
What version of the lib are you using? Please try updating to the latest, these methods should be there:
Thanks @koltyakov , I am able to find these methods. And this works fine to update properties for logged-in user. But in my case, I need to update Profile Property of some different user (other then logged in). So, I need to connect to Tenant and use Tenant scoped peopleManager..
Question is : Can I configure scope of 'sp' in 'sp-pnp-js' to connect to Tenant ?
As this can be done in JSOM
const context:SP.ClientContext = new SP.ClientContext("TanentUrl"); const peopleManager: SP.UserProfiles.PeopleManager = new SP.UserProfiles.PeopleManager(context);
So, I followed steps as mentioned above in thread.
Still, SP/SP.UserProfile is getting referred from "\node_modules\@types\sharepoint\index.d.ts".
and it does not have those functions..
peopleManager.setSingleValuedProfileProperty(
is not defined in JSOM approach.
This isn't a scenario we currently support. We reference the types from SharePoint as they are used to enable building and type support in a few areas, we don't make use of or expose the SP libraries through this library. So for now you could use the JSOM library OR perhaps write a small server side application to handle this task.
I am trying to update User Profile property for other user but not able to find setSingleValuedProfileProperty / setMultiValuedProfileProperty. Tried: 1) included @types/sharepoint It has all UserProfiles.js functions SharePoint 2016 on-premise, but missing some function definitions specifically for SharePoint Online.
2) Using CSOM : https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-sharepoint-using-jsom included SP.UserProfiles.js as external file
(static url :"https://static.sharepointonline.com/bld/_layouts/15/16.0.7428.1205/sp.userprofiles.js) Not able to refer it correctly.
"sharepoint-userprofile": { "path": "https://static.sharepointonline.com/bld/_layouts/15/16.0.7428.1205/sp.userprofiles.js", "globalName": "SP", "globalDependencies": [ "sharepoint" ] }
const context: SP.ClientContext = new SP.ClientContext("Tanent URL"); const peopleManager: SP.UserProfiles.PeopleManager = new SP.UserProfiles.PeopleManager(context); //Not defined //peopleManager.setSingleValuedProfileProperty