SharePoint User Group UK

Share the knowledge!

Welcome to SharePoint User Group UK Sign in | Join | Help
in
Home Blogs Forums Photos Files Roller

Exporting site content types.

Last post 09-05-2007, 3:38 PM by Cimares. 8 replies.
Sort Posts: Previous Next
  •  07-31-2007, 9:39 AM 4555

    Exporting site content types.

    Ok, dumb question of the day.. Can we export content types from the site content type gallery? I want to move the content type from the Dev environment into our UAT environment without exporting the entire site.

    Any ideas.


    www.myfatblog.co.uk
    twitter.com/@cimares
  •  07-31-2007, 9:59 AM 4556 in reply to 4555

    Re: Exporting site content types.

    I'm thinking that the SharePoint solution generator must help do this kind of thing? Logically the Solution Generator must need to export Content Types in order recreate lists and libraries within the Template it generates. Last time I saw this tool demonstrated was at the conference in Berlin, it looked a little buggy but I think it has moved on since then.

    http://www.microsoft.com/downloads/details.aspx?familyid=19f21e5e-b715-4f0c-b959-8c6dcbdc1057&displaylang=en

    Of course you could first define your content types as a Feature using CAML and then deploy them easily using WSP....

    Hope this helps

    Chris Hines 

     


    http://www.chrishines.com/techblog
  •  07-31-2007, 10:01 AM 4557 in reply to 4555

    Re: Exporting site content types.

    The administration in SharePoint doesn't allow you to export content types.  You need to write a feature that defines your content types.  I usually create a separate feature for Site Columns and another for the content type, that way you can install and activate the site columns first.

    I wrote a tool (Content Types Viewer) that allows you to view content types http://www.codeplex.com/MOSS2K7CTypesViewer and an article about creating features for content types using the Content Types Viewer http://dhunter-thinkingoutaloud.blogspot.com/2007/06/creating-content-types-with-content.html.

    Dave


    My SharePoint Blog http://www.davehunter.co.uk
  •  07-31-2007, 11:43 AM 4563 in reply to 4557

    Re: Exporting site content types.

    Hi Dave,

    I checked out your tool. Very nice!

    Quite often we get non-developers to prototype new features using the UI but we then need to re-define this funtionality in CAML so that we can put it into Features etc. This tool could shave quite a bit of time off the process.

    Chris

     


    http://www.chrishines.com/techblog
  •  07-31-2007, 1:29 PM 4568 in reply to 4563

    Re: Exporting site content types.

    Hi Chris,

    Thanks for the positive feedback.  I prefer creating content types with the administration rather than hand coding xml files that represent the site columns and content types.

    I'm looking to take the functionality of the tool further to include creating features for site columns and content types.  I will also try and make the UI more intuitive.  Any feedback is welcome.

    Just a quick point ....The SharePoint Solution Generator doesn't work with Portal or Publishing site templates, works fine with WSS site templates.  When you use it with lists that support content types you get the association but it doesn't create the content type as a feature.

    Thanks

    Dave


    My SharePoint Blog http://www.davehunter.co.uk
  •  07-31-2007, 1:40 PM 4569 in reply to 4568

    Re: Exporting site content types.

    Andrew Connell also has a tool which will supply the XML used for content types and site columns. Comes in the form of a custom STSADM command, available at http://www.andrewconnell.com/blog/articles/MossStsadmWcmCommands.aspx

    Cheers,

    Chris.
    http://sharepointnutsandbolts.blogspot.com/

     

  •  07-31-2007, 2:04 PM 4570 in reply to 4568

    Re: Exporting site content types.

    Here's one for you.....

    I define my Content Type to RemoveFieldRef Title and use MyAlternativeTitle instead:

     <ContentType ID="0x0100D767501FD80F4d16ADABFB50EFDE0B8B"
      Name="MyContentType"
      Group="CMH"
      Description="CMH My Content Type"
      Sealed="FALSE"
      ReadOnly="FALSE"
      Hidden="FALSE">
      <FieldRefs>
       <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title"/>
       <FieldRef ID="{C9876BF9-4D64-4277-BC0A-5FE974925959}" Name="MyAlternativeTitle" />
      </FieldRefs>
     </ContentType>

     

    However, the tool does not show the RemoveFieldRef in the CAML it generates:

     

    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <ContentType ID='0x0100D767501FD80F4D16ADABFB50EFDE0B8B' Name='MyContentType' Group='CMH' Version='0'>
    <FieldRefs>
       <FieldRef ID="{C9876BF9-4D64-4277-BC0A-5FE974925959}" Name="MyAlternativeTitle" />
    </FieldRefs>
    </ContentType>
    </Elements>

     

     

     


    http://www.chrishines.com/techblog
  •  08-01-2007, 11:42 AM 4579 in reply to 4570

    Re: Exporting site content types.

    Ah I make no claims about Andrew's tool myself!

    Though I note AC's comment:

    Will it give you exactly what you want? Maybe (likely) not, but it sure is easier to have a file you can tweak and prune rather than building one from scratch... not to mention a faster development experience.

  •  09-05-2007, 3:38 PM 5268 in reply to 4568

    Re: Exporting site content types.

    Thanks for the pointer to your tool Dave, that does exactly what i want as I have already fully defined the Content Type within the dev environment and really don't want to do that manually again!

    I've since deployed two features as per your post on your blog and packaged them up into solutions to make them easy to deploy.

    Paul.


    www.myfatblog.co.uk
    twitter.com/@cimares
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems