We have two sharepoint farms in same company network

  1. http://farm1 (Internet anonymous sharpoint site)
  2. http://farm2 (Intranet sharepoint site)

Farm1 has a list called list1 under one of the site collection.

We have a site page under one of the site collection of Farm2 and requirement is to the data from list1 on this webpage under farm2.

What are our options?

  1. Can we use REST calls, if cross site scripting is going to be issue, is there any way to avoid it and still use REST calls

  2. Our worst case option is to recreate list through task scheduler every night on Farm 2 using the template from list1.

  • what about inserting a webpage viewer web part?
    – teylyn
    Jan 9, 2017 at 6:11
  • Thanks Teylyn, however Data will be processed to show in the custom interface (jquery datatble ) once received on the webpag.
    – Rohit
    Jan 9, 2017 at 6:37

2 Answers 2


Try to use the SharePoint Client Object Model: you can create C# code that runs outside of the context of the farm being accessed.


You can use C# for this, Below is the code to connect to SharePoint and perform Rest Calls

//Get Request Digest
HttpWebRequestendpointRequest = (HttpWebRequest)HttpWebRequest.Create("<<site
endpointRequest.Method = "POST";
endpointRequest.Accept = "application/json;odata=verbose";
endpointRequest.ContentType = "application/x-www-form-urlencoded";
endpointRequest.ContentLength = 0;
NetworkCredential cred = newSystem.Net.NetworkCredential("username", "password", "domain");
endpointRequest.Credentials = cred;
HttpWebResponseendpointResponse = (HttpWebResponse)endpointRequest.GetResponse();
//Sample Post Command
HttpWebRequestendpointRequest = (HttpWebRequest)HttpWebRequest.Create("<<REST URL>>");
endpointRequest.Method = "POST";
endpointRequest.Accept = "application/json;odata=verbose";
endpointRequest.ContentType = "application/json;odata=verbose";
NetworkCredential cred = newSystem.Net.NetworkCredential("username", "password", "domain");
endpointRequest.Credentials = cred;
String username = "username";
String password = "password";
StringuserPassword = username + ":" + password;
byte[] byteArrayUP = Encoding.UTF8.GetBytes(userPassword);
endpointRequest.Headers.Add("Authorization", "Bearer" + byteArrayUP);
stringpostData = "{ '__metadata': { 'type': 'SP.Data.<<ListTitle>>ListItem' }, 'Column1':
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
// endpointRequest.ContentLength = byteArray.Length;
endpointRequest.Headers.Add("X-RequestDigest", digest);
// Get the request stream.
StreamdataStream = endpointRequest.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
HttpWebResponseendpointResponse = (HttpWebResponse)endpointRequest.GetResponse();


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.