使用 Web 服务更新 UserProfile 时 SharePoint 2010 中出现异常

发布于 2024-09-16 17:28:13 字数 962 浏览 1 评论 0原文

我正在使用下面的代码更新 UserProfile


using System;
using System.Collections.Generic;
using System.Text;

namespace UserProfileWebServiceApp
{
    class Program
    {
        public static localhost.UserProfileService myService =
            new localhost.UserProfileService();
        UserProfileWebService.localhost.PropertyData[] newdata = 
    new UserProfileWebService.localhost.PropertyData[1];
            newdata[0] = 
                new UserProfileWebService.localhost.PropertyData();
            newdata[0].Name = "HomePhone";
            newdata[0].Values = new ValueData[1];
            newdata[0].Values[0] = new ValueData();
            newdata[0].Values[0].Value = "aa";
            newdata[0].IsValueChanged = true;
            myService.ModifyUserPropertyByAccountName("domainname\\username", 
                newdata);

    }
}

an soap exception occur --> Attempted to perform an unauthorized operation.
anyone help me
thanks

I'm updating the UserProfile using the code below



using System;
using System.Collections.Generic;
using System.Text;

namespace UserProfileWebServiceApp
{
    class Program
    {
        public static localhost.UserProfileService myService =
            new localhost.UserProfileService();
        UserProfileWebService.localhost.PropertyData[] newdata = 
    new UserProfileWebService.localhost.PropertyData[1];
            newdata[0] = 
                new UserProfileWebService.localhost.PropertyData();
            newdata[0].Name = "HomePhone";
            newdata[0].Values = new ValueData[1];
            newdata[0].Values[0] = new ValueData();
            newdata[0].Values[0].Value = "aa";
            newdata[0].IsValueChanged = true;
            myService.ModifyUserPropertyByAccountName("domainname\\username", 
                newdata);

    }
}

an soap exception occur --> Attempted to perform an unauthorized operation.
anyone help me
thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泅人 2024-09-23 17:28:13

运行此应用程序的帐户(如果您在计算机上进行开发,则可能是您的帐户)需要具有正确的权限来管理 User Profile Service 应用程序中的用户配置文件。我认为您还可以在对具有管理用户配置文件权限的帐户/密码的服务调用中指定凭据。

The account this application is running under (probably your account if you developing on your machine) needs to have the correct permissions to manage user profile in the User Profile Service application. I think you can also specify credentials in the service call to an account/password that has manage user profile permissions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文