Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:24:20+00:00 2026-05-25T15:24:20+00:00

I have list of clients through which i have created SharePoint user groups with

  • 0

I have list of clients through which i have created SharePoint user groups with this code.

namespace CreateGroupCSharp.EventReceiver1
{
    public class EventReceiver1 : SPItemEventReceiver
    {  
       public override void ItemAdded(SPItemEventProperties properties)
       {
           using (SPSite site = new SPSite("http://abc/"))
           {          
               SPWeb web = site.AllWebs[0];

               SPList customList = web.Lists["Client"];

               string strCount = properties.ListItem.Title.ToString();

               string status = properties.Status.ToString();            

               SPGroup groupOwner = web.SiteGroups.GetByID(int.Parse(web.Properties["vti_associateownergroup"]));

               string groupName = strCount;

               web.SiteGroups.Add(groupName, groupOwner, null, "Custom SharePoint Group for Demo");

               SPGroup wcmGroup = web.SiteGroups[groupName];

               SPRoleDefinition designerRoleDefinition = web.RoleDefinitions["Contribute"];

               SPRoleAssignment roleAssignment = new SPRoleAssignment(wcmGroup);

               roleAssignment.RoleDefinitionBindings.Add(designerRoleDefinition);

               web.RoleAssignments.Add(roleAssignment);
               wcmGroup.Update();                              
               web.Update();              
           }

           base.ItemAdded(properties);
       }
    }
}

Is it possible to create users for each client in SharePoint list itself?
How can I assign these created groups to the the users in list?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:24:21+00:00Added an answer on May 25, 2026 at 3:24 pm

    I would add a Person or Group column named Users to your list. Allow multiple selections and allow people only (no groups) to be selected. You can then add the users to the group using the following code in your event receiver:

    private void AddUsers(SPWeb web, SPGroup group, SPListItem item)
    {
        object value = item["Users"];
        if (null != value)
        {
            SPFieldUserValueCollection userValues = 
                new SPFieldUserValueCollection(web, value.ToString());
            foreach (SPFieldUserValue userValue in userValues)
            {
                SPUser user = userValue.User;
                if (null == user)
                {
                    user = web.EnsureUser(userValue.LookupValue);
                }
                group.AddUser(user.LoginName, user.Email, user.Name, null);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view called, clients which shows a list of calls from the
I have a SharePoint List to which I'm adding new ListItems using the Client
I'm trying to use a list of clients that have been created from my
I have a list of checkboxes like you would see in most email clients
I have a page in Sitecore that displays the list of clients. There's a
I have List I want to sort Desc by Priority, which is int and
i have list of rows that user select and i want to delete them,
The following code generates a list of the average number of clients connected by
I'm at a client site where they have an application which began in SharePoint
I have created a simple mod_perl module, which writes a 0-terminated string to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.