I am trying to create a web part which shows a list of all members of a specific sharepoint group. One of the columns of the list must be SPFieldType.User. Do I need to create a SPList? When do I need to update the list? when you add a new user to the group or when the page which contains the web part reloads? what is the best solution? thank you. (I dont want to use Members web part)
Unfortunately there is no easy solution for doing this in the general case, because the recommended way to add people to SharePoint groups is to do it through AD-groups which can be nested, cross-domain, ...
If you make the assumption that users are only added directly to the SharePoint group, then your web part can just show the content of the SPGroup.Users property and there is no need to maintain a list for that.
thank, How do I show users on a Web Part which contains a column which is SPFieldType.User? Sep 28, 2012 at 6:48
I wanted just to say thant I solved. No need for List only showing all data I need in a SPGridView. Sep 28, 2012 at 10:27
SharePoint already got a list on Top Level Site for managing the users and groups called "User Information List". So you don't need to create a separate List for that.
You can create a webpart, to show all the users for the specified group. For group specification, create a custom property in webpart to specify the SharePoint Group Name.
Yes, I have searched on Internet to find out how do you create a Web Part which contains a columen which is SPFieldType.User, I haven't find. Sep 28, 2012 at 7:40
May I know, why do you want the SPFieldType.User in the webpart? Sep 28, 2012 at 8:30
I want to have a custom Site user webpart which will be a list of all users in a specific group and one of columns must be a User type. Sep 28, 2012 at 10:11
I solved it by using SPGridView, without no need for a list. thanks Sep 28, 2012 at 10:28
Please refer to This link . Here the author tries to retrieve all users from all groups.
1) you need not create a new list. 2) Modify the code in above link to suit your needs. You can specify the group name in object model or have it as a property in your wen part.
Thank you for the link, my problem was how do I show users in a web part which contains spFieldType.User Sep 28, 2012 at 6:47