SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a site column defined in an Elements.xml file in Visual Studio. The SharePoint project this is in does all sorts of initial configuration on the website. I need to set the UserSelectionScope to be a certain group, however this won't work unless the group already exists and I know the ID, which I do not because the group in question is create in code in the feature event handler.

Essentially, I am trying to capture all of the initial setup and configuration of this SharePoint site in a single feature/solution that doesn't require manual intermediate steps.

Does anyone know if it's possible to set the UserSelectionScope by doing some kind of lookup by name? If not, does anyone have any suggestions?

Thanks in advance.

share|improve this question
up vote 1 down vote accepted

Does this help?

Gets the group by name, and then calls the Id.

share|improve this answer
I was afraid this might be the only solution. Very poor maintainability having half of a site column being made in XML and half in code. Gotta love SharePoint... – MgSam Jul 27 '12 at 16:49
Yeah, I've run into a similar situation before. Getting Guids dynamically is clunky, but achievable. – RJ Cuthbertson Jul 27 '12 at 17:18

A quick one I thought of:

Why don't you only create the Field in the Elements.xml and then set the UserSelectionScope property of that field in the Event Handler after the group is created?

You can use the following property from the Object Model:

share|improve this answer

Your Answer


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.