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

时间:2010-08-26 12:34:14

标签: sharepoint sharepoint-2010 user-profile

我正在使用下面的代码更新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

1 个答案:

答案 0 :(得分:2)

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