Search code examples
web-servicessharepointcontent-typesite-column

ContentTypes and Site Column migration in SharePoint using web service


I am trying to migrate a content type from a sharepoint site in one environment to another. For this reason, I need to use web services. At this point, I am able to get some of the content types metadata via the web service. But I am not sure if I am getting all the metadata. I am using the Webs.GetContentTypes() method to do this.

In the next step, I need to figure out the site columns that are associated with this content type, import these columns, and associate the content type with these imported columns.

I am looking to figure out the following:

  1. How do I know what site columns are associated with a given content type via web service? Or do I need to create a custom web service?
  2. How can I be sure that I have all the information required to reconstruct the content type in the destination server?

Any help in any capacity will greatly be appreciated. Thank you in advance.


Solution

  • The answer to both your question lay here: http://msdn.microsoft.com/en-us/library/webs.webs.getcontenttype(v=office.12).aspx (check out the remarks section as well)

    Once you have the ID for the content type that you need details for, call the Webs.GetContentType(ID) method on the that ct. You should get the schema xml i.e. all the info you need to create your content type somewhere else.