locked
moving content type and fields to new server RRS feed

  • Question

  • Hi

    How do I move content types and fields to a new server ? I created these fields manually via the UI.

    Thanks

     

    Monday, January 9, 2012 9:33 AM

Answers

  • You can have ContentType.xml and fields.xml as one file but it would be nice to have it seperate.
    Priyanka
    • Marked as answer by Mike Walsh FIN Wednesday, January 18, 2012 2:04 PM
    Wednesday, January 18, 2012 11:43 AM

All replies

  • I suppose the quickets way would be to save a list template that uses these content types, include the content and to see if they are recreated upon the target server.  Having not tested this, I'm not sure if it'll be fully workable.

    Ideally packaging these up via Visual Studio into a WSP would be the best solution.


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/
    Monday, January 9, 2012 9:53 AM
    Answerer
  • You can do it via one the following ways

    1) Using Sharepoint Manager 2010 tool, get the content type's and field's schema.xml. Once you have this, you will have the correct list of content types and Fields. Then, you can create a feature which deploys the content type and fields. Refer  Creating a Custom Content Type and Creating a Custom Field Item sections here. Adv.  of this is you can reuse this easily.

    2) Using Powershell scripts or console app , you can export the content types and fields into an XML file and then using another powershell script or console app import the content types and fields(i.e programtically recreate the content types and fields). I would recommend this approach..

    3) Not sure about this but you can try some of the migration tools..

     

     

     


    Priyanka
    Monday, January 9, 2012 10:16 AM
  • Hi, from the below code you get the contenty types schema file just get this schema file and create a feature and deploy to other server.

    	SPSite oSite = new SPSite("severname");
    			SPWeb oWeb = oSite.OpenWeb();
    			List<string> contentTypes = new List<string>();
    			SPContentTypeCollection ctcoll = oWeb.ContentTypes;
    			foreach (SPContentType ctype in ctcoll)
    			{
    				contentTypes.Add(ctype.Name);
    				string schema = ctype.SchemaXml.ToString();
    			}
    



    Anil
    • Marked as answer by Pengyu Zhao Wednesday, January 18, 2012 3:44 AM
    • Unmarked as answer by Mike Walsh FIN Wednesday, January 18, 2012 9:31 AM
    Monday, January 9, 2012 3:05 PM
  • Hi thanks everyone for the help.

    Anil, Where do I put the code ? I'm running sp2007, so sharepoin cmdlets dont work.

    Thanks again

    Monday, January 9, 2012 4:32 PM
  • Use it in a console application via Visual Studio.
    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/
    Monday, January 9, 2012 4:58 PM
    Answerer
  • Hi, try it in console application and get the schema.
    Anil
    • Marked as answer by Pengyu Zhao Wednesday, January 18, 2012 3:44 AM
    • Unmarked as answer by Mike Walsh FIN Wednesday, January 18, 2012 9:31 AM
    Tuesday, January 10, 2012 8:54 AM
  • Hi

    I've created a .stp file (exluded content) on my wss and then created a list based on the .stp on my Moss (new server).

    The list is created, when I goto list settings I can see my new content type under Content Types, and can see the new Coloumns.

    When I try to creat a new item I get a blank page (404 error).

    So I checked the 'Site Content types' and the CT is missing also 'Site Columns' is missing all the columns. Eventhough I can see these in the list settings. Whats going on here ?

    Thanks

    Wednesday, January 18, 2012 9:22 AM
  • Hi

    As my VS is broken I'm now trying option 1..

    1) Using Sharepoint Manager 2010 tool, get the content type's and field's schema.xml. Once you have this, you will have the correct list of content types and Fields. Then, you can create a feature which deploys the content type and fields. Refer Creating a Custom Content Type and Creating a Custom Field Item sections here. Adv. of this is you can reuse this easily.

    Do I need to create 3 files for the feature ? i.e feature.xml, ContentType.xml and Fileds.xml ?

    Wednesday, January 18, 2012 10:04 AM
  • You can have ContentType.xml and fields.xml as one file but it would be nice to have it seperate.
    Priyanka
    • Marked as answer by Mike Walsh FIN Wednesday, January 18, 2012 2:04 PM
    Wednesday, January 18, 2012 11:43 AM