【问题标题】:MOSS2007 UserProfile Property: programmatic access to "mapped attribute" in ADMOSS2007 UserProfile 属性:以编程方式访问 AD 中的“映射属性”
【发布时间】:2010-06-23 15:50:07
【问题描述】:

您可能知道,MOSS 2007 提供了将 Active Directory 属性与 SharePoint UserProfile 属性同步的功能。您可以将 AD 属性映射到 userProfile 属性 共享服务 > 用户配置文件和属性 > 查看配置文件属性(一直在底部)。

我目前正在研究将 userProfiles 上的修改同步回 AD 的可能性。

我是 SharePoint 的新手,并且在其 API 中苦苦挣扎,但到目前为止,我发现,您可以迭代 UserProfile 更改并找出时间戳、旧值、新值等。

    string siteUrl = @"http://[siteUrl]/";
    Microsoft.SharePoint.SPSite spsite = new Microsoft.SharePoint.SPSite(url);
    Microsoft.Office.Server.ServerContext serverContext = Microsoft.Office.Server.ServerContext.GetContext(spsite);
    Microsoft.Office.Server.UserProfiles.UserProfileManager userProfileMgr = new Microsoft.Office.Server.UserProfiles.UserProfileManager(serverContext);
    var collection = userProfileMgr.GetChanges();

    List<ProfilePropertyChange> changes = new List<ProfilePropertyChange>();
    foreach (Microsoft.Office.Server.UserProfiles.UserProfileChange change in collection)
    {
        if (change.ObjectType == Microsoft.Office.Server.UserProfiles.ObjectTypes.SingleValueProperty)
        {
            var singleValue = change as Microsoft.Office.Server.UserProfiles.UserProfileSingleValueChange;

        string oldValue = singleValue.OldValue;
        string newValue = singleValue.NewValue;
        var profileProperty = singleValue.ProfileProperty;
        DateTime modificationDate = singleValue.EventTime;

        ...

        }
    }

但是,我目前无法发现的是对所谓的“映射属性”(AD 中的原始属性名称)的编程访问。

谁能告诉我 SharePoint API 会为我揭示这些信息吗?

非常感谢

【问题讨论】:

    标签: sharepoint user-profile


    【解决方案1】:

    Steve Curran 非常友好地在 MSDN 论坛上解决了我的问题:

    http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/019c1e60-babb-4942-90e1-d33e924c7c73

    使用 PropertyMapCollection 你 可能能够查找映射的 AD 给定用户配置文件名称的属性。

    数据源 ds = upcm.GetDataSource(); PropertyMapCollection pmc = ds.PropertyMapping;

    http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.propertymapcollection%28office.12%29.aspx

    【讨论】:

      猜你喜欢
      • 2012-07-10
      • 1970-01-01
      • 1970-01-01
      • 2023-01-10
      • 2011-02-26
      • 2010-12-18
      • 2020-07-17
      • 2022-01-16
      • 2019-12-04
      相关资源
      最近更新 更多