我正在开发一个 Windows 应用程序,它允许 SharePoint 管理员将内容类型从一台服务器复制到另一台服务器(跨两个 SharePoint 环境)。我现在拥有想要复制的内容类型信息。但是,我无法连接到目标服务器。当我尝试使用目标站点 URL 创建 SPSite 对象时,出现“FileNotFound”异常;我的代码库位于源服务器上。
我的问题:SharePoint 对象模型是否支持连接到远程服务器?如果没有,我可以使用 SharePoint Web 服务在远程服务器中创建内容类型对象吗?如果没有,是否有其他替代 API(除了创建我自己的 Web 服务)来实现此目标?
感谢您提前的帮助!
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!
发布评论
评论(2)
在谈论 SharePoint 2010 时,您应该看看内容类型中心。通过使用内容类型中心,您可以使用元数据服务应用程序在 SharePoint SiteCollections 和 Web 应用程序之间轻松共享 ContentType。
因此您不必手动复制内容类型。
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.
要回答您的第一个问题,不,服务器对象模型只能用于本地环境。
Web Web 服务 ( http://msdn .microsoft.com/en-us/library/webs.webs_methods(v=office.12).aspx )具有创建/删除/更新内容类型的规定。
但请记住,内容类型理论上可能依赖于工作流、事件接收器、InfoPath 表单、解决方案等外部因素,这些外部因素将更难/不可能通过 OOTB Web 服务复制到新环境。
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.