Wednesday, June 16, 2010

Creating site columns thorugh SQL query

Sometimes, you may feel pain while creating site columns and content types through CAML, because you need to know CAML syntax for each and every site column data type, but you can avoid this by simply running one sql query

Normally in SharePoint when we create any site column or content type through SharePoint user interface that will go and stored into content database in the form of CAML, so we can run simple sql query and get that data and build it into features and deploy the same in some other environment means production

Steps

1. create sitecoumns and content types using SP user interface

2. connect to sql server database

3. Execute below query

"Select definition from content types where definition is not null"

4. you can see all site columns and content types in form CAML

5. just extract that and build a features and deploy

0 comments:

Post a Comment