使用JSOM从sharepoint托管应用程序中读取Sharepoint在线UserProfile

时间:2017-06-22 02:55:13

标签: sharepoint sharepoint-online user-profile sharepoint-jsom sharepoint-userprofile

我试图通过引用以下MSDN从sharepoint hostedapp获取sharepointonline用户配置文件

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

但是当我尝试执行代码时会抛出以下错误"错误:访问被拒绝。您无权执行此操作或访问此资源"。

在上面的文章中,他们提到要输入" domainName \\ userName",这里只是混淆了我应该为我的应用域或我的sharepointonline域提供哪个域。

由于我尝试了这两个域,但问题仍然存在。

任何人都请建议......

提前致谢

1 个答案:

答案 0 :(得分:1)

您的访问被拒绝,因为您的托管应用程序无需执行用户配置文件所需的权限。

在SharePoint Hosted App解决方案上,AppManifest.xml为您的应用授予访问权限。在你的情况下,它将是:

enter image description here

根据您的使用情况,您可能需要授予它不仅仅是“阅读”。

相关问题