简体   繁体   中英

Read Sharepoint online UserProfiles from sharepoint hosted app using JSOM

I'm trying to get the sharepointonline userprofiles from sharepoint hostedapp by refering the below MSDN

https://dev.office.com/sharepoint/docs/general-development/how-to-retrieve-user-profile-properties-by-using-the-javascript-object-model-in

but when am trying to execute the code it throws the following error "Error: Access denied. You do not have permission to perform this action or access this resource ".

In above artical they have mentioned to enter the "domainName\\\\userName", here am just confused whether which domain I should give either my app domain or my sharepointonline domain.

Since i tried both the domains but the issue remains same.

Anyone please advice...

Thanks in advance

You are getting access denied because your hosted app does not have to required permission to execute user profiles.

On your SharePoint Hosted App solution AppManifest.xml grant the necessary permission for your app to access. In your case it would be:

在此处输入图片说明

Depending on your usage you may require to grant it more than just "Read".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM