【问题标题】:Edit user profil properties with jquery sharepoint hosted app使用 jquery sharepoint 托管应用程序编辑用户配置文件属性
【发布时间】:2014-12-02 17:46:30
【问题描述】:

我为 Office 365 创建了一个共享点托管应用程序,我想更新用户配置文件属性。我使用了这段代码:

var clientContext = new SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);
peopleManager.setSingleValueProfileProperty(targetUser, "Activite", $("#txt_Activite").val());
context.executeQueryAsync(function () {
   //editeProfil();
   window.parent.location = hostweburl + "/Pages/MONPROFIL.aspx?&UserTarget=" + targetUser;
       }, onFail);

function onFail(data, args)
{
    console.log(args.get_message());
}

当我想编辑我的个人资料属性时没问题,但是对于其他用户个人资料我有这个错误:

Access denied

我使用的是管理员帐户。

【问题讨论】:

    标签: jquery sharepoint office365


    【解决方案1】:

    这是因为上下文对象来自普通网站集(当前)。如果您为 -admin 站点创建上下文,那么它将起作用。

    例如,如果您的租户名称是 test,那么您的上下文应该来自 https://test-admin.sharepoint.com,我相信它会起作用。

    我在 CSOM 上对此进行了测试,但我相信它也应该适用于 JSOM。

    问候, 锯齿

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-16
      • 1970-01-01
      • 2015-07-22
      • 1970-01-01
      相关资源
      最近更新 更多