MOSS2007 UserProfile 属性:以编程方式访问“映射属性”在公元

发布于 2024-09-07 02:39:07 字数 1494 浏览 3 评论 0 原文

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

我目前正在研究将用户配置文件上的修改同步回 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吗?

非常感谢

As you may know, MOSS 2007 offers functionality to synchronize Active Directory properties to SharePoint UserProfile Properties. You can map AD properties to userProfile properties in
Shared Services > User Profile and Properties > View Profile properties (all the way at the bottom).

I'm currently investigating the possibility to synchronize modifications on userProfiles back to AD.

I'm new to SharePoint and struggling my way through its API's, but what I dug up so far, is that you can iterate to UserProfile changes and find out timestamps, old values, new values, etc.

    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;

        ...

        }
    }

However, what I'm currently unable to discover, is programmatic access to the so called "Mapped Attribute" (the original property name in AD).

Can anybody point me to the SharePoint API that will reveale this information for me?

Many thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北风几吹夏 2024-09-14 02:39:08

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

Steve Curran was kind enough to address my question on the MSDN forum:

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

Using the PropertyMapCollection you
may be able to look up the mapped AD
attribute given the Userprofile name.

DataSource ds = upcm.GetDataSource();
PropertyMapCollection pmc =
ds.PropertyMapping;

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文