【问题标题】:How to get SPUser object from SocialProfile in Sharepoint 2010?如何从 Sharepoint 2010 中的 SocialProfile 获取 SPUser 对象?
【发布时间】:2011-08-05 01:02:07
【问题描述】:

如何从 Sharepoint 2010 中的 SocialProfile 获取与配置文件关联的 SPUser 对象?

谢谢

【问题讨论】:

    标签: sharepoint-2010 user-profile object-model spuser


    【解决方案1】:

    获取您链接的 msdn 文章中指定的用户登录名。 然后获取给定 SPSite 的用户,因为 SharePoint 用户(和组)是每个站点集合:

    SPWeb web = ...;
    web.AllUsers["<loginName>"];
    

    或者如果您想创建尚未退出的用户:

    web.EnsureUser("<loginName>");
    

    【讨论】:

      【解决方案2】:

      首先,获取所需用户的ID

      UserProfile profile = GetProfile();
      string userId = profile .MultiloginAccounts[0];
      

      其次,从以下集合之一中获取用户

      web.AllUsers, web.Users or web.SiteUser
      

      这篇文章是关于区别http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/71d1c8e3-de32-4e3d-9f8c-7a9be13197f6/

      【讨论】:

        猜你喜欢
        • 2011-06-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-06-21
        相关资源
        最近更新 更多