I am a beginner in Sharepoint and given a task to write timer jobs. Once triggered, i want to move documents from one Sharepoint server library to another server library programmatically. So far my findings says that this can only be possible using Client Object Model because i am unable to create the second Sharepoint server (spUrl2) instance with SPWebApplication.Lookup method using Server Object Model and this method returns null.

I am running following code from first Sharepoint server (spUrl1):

SPWebApplication primaryWebApplication = 
    SPWebApplication.Lookup(new Uri("http://spUrl1"));

SPWebApplication secondaryWebApplication = 
    SPWebApplication.Lookup(new Uri("http://spUrl2"));

Now my question is that is it possible to do the needful using Server Object Model because this is very convenient and i want the same thing. If not then how can i possibly do this file movement as i couldn't find similar reference related to this on web.

Thanks for your support in advance.

有帮助吗?

解决方案

You can not use server side object model for the different farm access.

You can use Client object model, Rest APIs or sharepoint web services.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top