开发者

Exception in SharePoint 2010 when updating UserProfile using a web service

开发者 https://www.devze.com 2023-01-13 09:15 出处:网络
I\'m updating the UserProfile using the code below using System; using System.Collections.Generic; using System.Text;

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 =
        开发者_JS百科    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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消