Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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)

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer
    
thank, How do I show users on a Web Part which contains a column which is SPFieldType.User? –  Medes Sep 28 '12 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 Sep 28 '12 at 10:27

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

share|improve this answer
    
Thank you for the link, my problem was how do I show users in a web part which contains spFieldType.User –  Medes Sep 28 '12 at 6:47

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.

share|improve this answer
    
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 Sep 28 '12 at 7:40
    
May I know, why do you want the SPFieldType.User in the webpart? –  Shantha Kumar Thambidurai Sep 28 '12 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 Sep 28 '12 at 10:11
    
I solved it by using SPGridView, without no need for a list. thanks –  Medes Sep 28 '12 at 10:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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