Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Adding users to the default members group

Adding users to the default members group

Scheduled Pinned Locked Moved SharePoint
databasehelpquestionsecurity
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aptiva Dave
    wrote on last edited by
    #1

    I was wanting to build a web control that did a few things for admins of a site. One of the processes was to add a user to the default members group of the site along with some other security settings. This was to help admins do all of this on one page instead of going to each group individually to add a user. Here is the code I am currently using to accomplish this:

    web.Groups("AR Test Site Members").AddUser(newStaff.User)

    This work fine on my test site, but when I move it over to production that group name will change to the [Site Name] Site Members. I noticed that you could also used an index of the group instead of the name, so I used '5' because I noticed that was in the query strings for the address to look at the group members. When I used '5', I get an argument out of range error. How can I find the index number of this default group so that when I build the code I don't have to worry about finding out which site I'm on?

    I 1 Reply Last reply
    0
    • A Aptiva Dave

      I was wanting to build a web control that did a few things for admins of a site. One of the processes was to add a user to the default members group of the site along with some other security settings. This was to help admins do all of this on one page instead of going to each group individually to add a user. Here is the code I am currently using to accomplish this:

      web.Groups("AR Test Site Members").AddUser(newStaff.User)

      This work fine on my test site, but when I move it over to production that group name will change to the [Site Name] Site Members. I noticed that you could also used an index of the group instead of the name, so I used '5' because I noticed that was in the query strings for the address to look at the group members. When I used '5', I get an argument out of range error. How can I find the index number of this default group so that when I build the code I don't have to worry about finding out which site I'm on?

      I Offline
      I Offline
      Ingo
      wrote on last edited by
      #2

      Aptiva Dave wrote:

      group name will change to the [Site Name] Site Members

      go through each element of the site groups collection and look if the name contains "Site Members" (or ends with site members).

      ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

      B 1 Reply Last reply
      0
      • I Ingo

        Aptiva Dave wrote:

        group name will change to the [Site Name] Site Members

        go through each element of the site groups collection and look if the name contains "Site Members" (or ends with site members).

        ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

        B Offline
        B Offline
        balaji1010
        wrote on last edited by
        #3

        Yes group name will appear with site name and Member group,visitors,owners

        I 1 Reply Last reply
        0
        • B balaji1010

          Yes group name will appear with site name and Member group,visitors,owners

          I Offline
          I Offline
          Ingo
          wrote on last edited by
          #4

          It wasn't a question, that was the work the code should do.

          ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

          B 1 Reply Last reply
          0
          • I Ingo

            It wasn't a question, that was the work the code should do.

            ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

            B Offline
            B Offline
            balaji1010
            wrote on last edited by
            #5

            OK.But users who has Contribute permissions will be added directly to members group.

            I 1 Reply Last reply
            0
            • B balaji1010

              OK.But users who has Contribute permissions will be added directly to members group.

              I Offline
              I Offline
              Ingo
              wrote on last edited by
              #6

              balaji1010 wrote:

              OK.But users who has Contribute permissions will be added directly to members group.

              Yes but the wasn't the question asked. The question was: How can he identify the "Site Members" group, when he don't know how the site is called.

              ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups