Do you remember the times they asked you to create a feature for the creation of all custom content types and site columns for this new MOSS 2007 project ? Most of the time you would prepare your self for a long struggle with the CAML XML language and the many options it offers you to create everything you need.
Thanks to some clever tools on the web and a little bit of work, you can do this job in a matter of minutes. I will quickly describe the procedure to do this really fast:
1. Create the columns
Fire up your dev machine and go to the site columns list. In there, create all the site columns you need. Don't forget to put them all in a new group so all our custom site columns are nicely grouped. This will help us later on.
2. Create the content types
On your dev machine, go to the site content types list. Create all your content types, inherit from existing content type if needed and complete them with custom site columns. Also put all the custom content types in a new group.
3. Download Andrew Connell's stsadm extensions
Go to http://www.andrewconnell.com/blog/articles/MossStsadmWcmCommands.aspx and download the latest version of the installer. It's a wsp. Install and deploy it on your dev machine.
If everything went right, you will now be able to execute some new and very interesting stsadm commands.
4. Extract the CAML XML for the site columns and content types
Open up your command line and execute the following command:
STSADM.EXE -o GenSiteColumnsXml -url http://wcm -outputFile "c:\siteColumns.xml" -groupFilter group
and type in the correct url to your site collection (where you created the site content types and site columns) and a destination for the CAML XML file. Also provide the correct group name so we don't extract all site columns.
Then execute this command, again with the correct parameters:
STSADM.EXE -o GenContentTypesXml -url http://wcm1 -outputFile "c:\contentTypes.xml" -groupFilter group
5. Do some small xml manipulations
The site column xml file can be used instantly in any feature. All site columns will be created correctly. You will notive however an 'extra' property: SourceID. The official MSDN documentation for this can be found here: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.sourceid.aspx. After extraction this property contains a GUID, the default value would be 'http://schemas.microsoft.com/sharepoint/v3'. Anyway, this property will not in any way have an influence on the correct working and installation of your custom site columns.
Unfortunately, the xml for the content types isn't always right. If you inherit from a content type, references to the site columns of this content type will also be included in the xml definition. Of course this is not needed because we are inheriting. So delete all the site columns that are part of the parent content type anyway.
Also delete possibly included 'XmlDocuments' tags as these are also not needed in our custom content types:
You can now also use this xml in any feature and it will correctly create your content types.
If, after installation of your site columns and content types, you try to go to the content types overview and the loading of that page is very slow (and infact will never show up), there is still some unneeded xml in the definition of the content types.
6. Conclusion
Using this method I can now create features for content types and site columns in minutes without having to struggle with the CAML xml too much. Also, all the properties are set correctly by the GUI so no problems there either. In my next post (which will not be today because it's very late) I will explain how you can also create lookup fields using a feature.
SharePoint 2010 Extended Variations
donderdag 30 juli 2009
SharePoint SP2 & June Cumulative Update Packages
I know I'm very late with this but I just opened this blog and wanted to post a first quick post. Microsoft recently released service pack 2 for SharePoint 2007 which of course includes all the previous hot fixes and solves many issues.
Download links:
* WSS 3.0 SP2: http://www.microsoft.com/downloads/details.aspx?familyid=79BADA82-C13F-44C1-BDC1-D0447337051B&displaylang=en
* MOSS 2007 SP2: http://www.microsoft.com/downloads/details.aspx?FamilyID=b7816d90-5fc6-4347-89b0-a80deb27a082&displaylang=en
Also don't forget to install this SP2 hotfix which will solve a small bug in the SP2 installation: the product expiration date is activated incorrectly.
* http://support.microsoft.com/kb/971620
Microsoft also recently released the June Cumulative Update Packages Ready for Download:
* WSS 3.0: http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=971538
* Moss 2007: http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=971537
More info on all this can be found on the SharePoint Team Blog:
http://blogs.msdn.com/sharepoint/archive/2009/07/20/june-cumulative-update-packages-ready-for-download.aspx
Download links:
* WSS 3.0 SP2: http://www.microsoft.com/downloads/details.aspx?familyid=79BADA82-C13F-44C1-BDC1-D0447337051B&displaylang=en
* MOSS 2007 SP2: http://www.microsoft.com/downloads/details.aspx?FamilyID=b7816d90-5fc6-4347-89b0-a80deb27a082&displaylang=en
Also don't forget to install this SP2 hotfix which will solve a small bug in the SP2 installation: the product expiration date is activated incorrectly.
* http://support.microsoft.com/kb/971620
Microsoft also recently released the June Cumulative Update Packages Ready for Download:
* WSS 3.0: http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=971538
* Moss 2007: http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=971537
More info on all this can be found on the SharePoint Team Blog:
http://blogs.msdn.com/sharepoint/archive/2009/07/20/june-cumulative-update-packages-ready-for-download.aspx
Abonneren op:
Posts (Atom)