Reputation: 359
I need to programmatically, using C#, add the SharePoint Web Part "Site Users" to a page.
I know how to add web parts but how do I get the "Site Users" web part from Share Point? I do not know how to instance it.
Thanks for helping.
Upvotes: 2
Views: 1944
Reputation: 359
The answer turned out to be the Members Web Part.
By simply setting "Display Type" to "WebUserGroups" the web part lists the groups and users on the site.
MembersWebPart membersWebPart = new MembersWebPart();
membersWebPart.DisplayType = MembersWebPartDisplayType.WebUserGroups;
membersWebPart.Title = "Användare och grupper";
wpManager.AddWebPart(membersWebPart, "Right", 2);
Upvotes: 2