0

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)

3 Answers 3

1

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.

2
  • thank, How do I show users on a Web Part which contains a column which is SPFieldType.User?
    – Medes
    Commented 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.
    – Medes
    Commented Sep 28, 2012 at 10:27
1

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.

4
  • 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.
    – Medes
    Commented Sep 28, 2012 at 7:40
  • May I know, why do you want the SPFieldType.User in the webpart? Commented 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.
    – Medes
    Commented Sep 28, 2012 at 10:11
  • I solved it by using SPGridView, without no need for a list. thanks
    – Medes
    Commented Sep 28, 2012 at 10:28
0

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.

Cheers

1
  • Thank you for the link, my problem was how do I show users in a web part which contains spFieldType.User
    – Medes
    Commented Sep 28, 2012 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.