2010-08-26 62 views
1

我正在使用的代碼更新用戶配置下面異常SharePoint 2010中更新用戶配置使用web服務


 

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 

回答

2

該申請是根據(可能是您的帳戶上運行,如果你開發的帳戶,當你計算機)需要具有正確的權限才能在User Profile Service應用程序中管理用戶配置文件。我認爲您還可以在服務調用中指定具有管理用戶配置文件權限的帳戶/密碼的憑據。

相關問題