我的web应用程序是使用HTML5和Jquery的ASP.NET MVC 4 Web应用程序。检索和编辑Sharepoint Active Directory用户配置文件属性
我正在编写Web应用程序以使用Active Directory从Sharepoint服务器检索和编辑数据。
我可以检索信息,但我试图找出一种方法来编辑和提交更改到活动目录帐户。我一直无法找到与远程Web应用程序访问有关的代码示例。我所见过的唯一编辑样本只能在SharePoint服务器上完成。
我想知道我们是否完全忽略了有关Active Directory的事情,如果我试图做甚至可能。
注:
我一直没能找到的代码编辑Active Directory的信息呢。这是我目前检索的代码。我希望能够撤消信息,编辑名字或姓氏等属性,然后将更改提交到SharePoint Active Directory。
在此先感谢您的答案!
ClientContext currentContext = new ClientContext(serverAddress);
currentContext.Credentials = new System.Net.NetworkCredential(adminAccount, password);
const string targetUser = "domain\\targetAccountName";
Microsoft.SharePoint.Client.UserProfiles.PeopleManager peopleManager = new Microsoft.SharePoint.Client.UserProfiles.PeopleManager(currentContext);
Microsoft.SharePoint.Client.UserProfiles.PersonProperties personProperties = peopleManager.GetPropertiesFor(targetUser);
currentContext.Load(personProperties, p => p.AccountName, p => p.UserProfileProperties);
currentContext.ExecuteQuery();
foreach (var property in personProperties.UserProfileProperties)
{
//Pull User Account Name
//Edit Account name to new value
//Commit changes
}
谢谢!这正是我所期待的。看起来好像有很多不同的方式来获取这些SharePoint特定的属性。 –