I have a powershell script that does the following:
- Create web application x
- Add and install some wsps
- Create site collection using a site definition deployed with one of the wsps. 3b. The definition activates some features along with one that provisions some new managed metadata fields.
However when I use any of the fields as columns in a list or library they are always disabled. I know I need to activate the TaxonomyFieldAdded feature before I provision my own fields and I've tried this in several ways:
- Placed the feature id in in the onet.xml file at the top before the feature that provisions my fields.
- Specify that my feature depends on the TaxonomyFieldAdded feature (while also specified on the onet.xml file).
- Specify that my feature depends on the TaxonomyFieldAdded feature (while not specified on the onet.xml file).
- Activating the feature in the FeatureActivated event receiver before I finish provisioning fields in my Fields feature.
None of the above has worked. The strange thing is that if I create the site collection from Central Admin the fields work fine. Also if I delete and create the site collection again (while keeping the wsps and the web application) through powershell it also works. Can anyone help me find out what is going on here?
Edit: I've used this guide to create my fields: http://www.sharepointconfig.com/2011/03/the-complete-guide-to-provisioning-sharepoint-2010-managed-metadata-fields/
Edit2: Although I could be wrong I don't believe the field definitions themselves are the problem. They are set up almost exactly (apart from names and guids) according to the example in my link and they work as long as I create Site Collections through Central Admin, but not through the initial powershell.
Edit3: Creating new managed metadata fields works fine so there must be something with the order of events.