sharepointcontent-typesharepoint-object-model

Copying Content Types across SharePoint servers


I am developing a Windows application that will allow SharePoint administrators to copy a content type from one server to another (across two SharePoint environments). I am at a point where I have the content type information that I want to copy. However, I am not being able to connect to the destination server. I get a "FileNotFound" exception when I try to create a SPSite object using the destination site URL; my code base is on the source server.

My question: Does the SharePoint object model support connecting to a remote server? If not, can I create a content type object in the remote server using SharePoint web services? If not, is there any other alternative API (other than creating my own web service) to achieve this goal?

Thank you for you help in advance!


Solution

  • To answer your first question, no, the server object model can only used against the local environment.

    The Webs web service ( http://msdn.microsoft.com/en-us/library/webs.webs_methods(v=office.12).aspx ) has provisions for creating/deleting/updating Content Types.

    Keep in mind however that Content Types could theoretheticaly depend on externalities like workflows, event receivers, InfoPath forms, solutions and the like which will be harder/impossible to copy over to a new environment through the OOTB web services.