使用 Web 服务更新 UserProfile 时 SharePoint 2010 中出现异常
我正在使用下面的代码更新 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
运行此应用程序的帐户(如果您在计算机上进行开发,则可能是您的帐户)需要具有正确的权限来管理 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.