My query is i want to store a list of users from sharepoint site in string.
i have sp_user group that contain all the user of sp_group. I have another group Moss_2007Admin that have admin users. How can i get all users name e.g. "Domain\username;Domain\username1;Domain\username2" into string type variable that i am g开发者_如何学运维oing to use in my custom webpart.
Please help on this. Thanks.
Top of my head and have not checked in compiler :-
private string listUsers(SPGroup group)
{
StringBuilder sb = new StringBuilder()
foreach (SPUser user in group)
sb.AppendFormat("{0};",user.LoginName);
return sb.ToString();
}
See SPUser
精彩评论