0

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!

Tom
  • 510
  • 1
  • 7
  • 24

2 Answers2

1

When talking about SharePoint 2010, you should have a look at the Content Type Hub. By using the Content Type Hub, you're able to easily share ContentTypes across SharePoint SiteCollections and WebApplications using the Metadata Service Application.

So you'll not have to copy the Content Type manually.

Thorsten Hans
  • 2,675
  • 19
  • 21
0

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.

Mark Mascolino
  • 2,227
  • 1
  • 15
  • 19
  • 1
    The Server Object Model supports working against a remote farm, by using the SPFarm.Open method, but I would not recommend it as it's very easy to make mistakes which causes you to suddenly work against the local farm. – Per Jakobsen Jul 29 '11 at 06:21