Elements.xml Id substitution
-
09-12-2019 - |
Question
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.
Solution
Does this help?
http://jankrogh.blogspot.com/2012/03/setting-userselectionscope-of-user.html
Gets the group by name, and then calls the Id.
OTHER TIPS
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: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfielduser.selectiongroup.aspx