开发者

How to get SPUser object from SocialProfile in Sharepoint 2010?

How can I get the SPUser object associated to the prof开发者_Go百科ile from the SocialProfile in Sharepoint 2010?

Thanks


Get the login name of the user as specified in the msdn article you linked. Then get the user for the given SPSite, since SharePoint users (and groups) are per site-collection:

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

or if you want to create the user if it not already exits:

web.EnsureUser("<loginName>");


First, get the ID of the required user

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

Second, get user from one of the following collections

web.AllUsers, web.Users or web.SiteUser

This article is about the differences http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/71d1c8e3-de32-4e3d-9f8c-7a9be13197f6/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜