开发者

How to get Domain\users name in string type variable from sharepoint site into custom webpart

开发者 https://www.devze.com 2023-01-09 21:28 出处:网络
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

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

0

精彩评论

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