I've been battling with this for a number of days and I just can't get to the bottom of it. I have a SharePoint 2010 publishing site and a SharePoint 2016 publishing site. Both on prem, but different farms within the same network. I need pull list data from various lists Pages library, Calendars from 2010 into SharePoint 2016. I need to get value for various publishing fields (images, rich text, calendar event fields, etc). Remember I'm querying a SharePoint 2010 farm from a SharePoint 2016 farm.
So I tried a number of things
SOAP call to the Lists.asmx via JavaScript (added this in a script editor webpart on SP2016 Page - this one doesn't work with Chrome - I get "Failed to load resource: the server responded with a status of 401 (Unauthorized). XMLHttpRequest cannot load _vti_bin/Lists.asmx. Response for preflight has invalid HTTP status code 401". Works partially in IE. The PublishingRollupImage and PublishingImageCaption fields come back as "undefined"
$(document).ready(function() { var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \ <soapenv:Body> \ <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \ <listName>"+listName+"</listName> \ <viewFields> \ <ViewFields> \ <FieldRef Name='Title' /> \ <FieldRef Name='PublishingRollupImage' /> \ <FieldRef Name='PublishingImageCaption' /> \ </ViewFields> \ </viewFields> \ <rowLimit>9</rowLimit> \ </GetListItems> \ </soapenv:Body> \ </soapenv:Envelope>"; $.ajax({ url: "https://site.mycompany.com/_vti_bin/Lists.asmx"; type: "POST", dataType: "xml", data: soapEnv, complete: processResult, contentType: "text/xml; charset=\"utf-8\""
}); });
- Then I tried the SPServices library - same story as #1.
- Then I created a webpart (farm solution on 2016) as per this thread here: https://stackoverflow.com/questions/4791794/client-to-send-soap-request-and-received-response
I get a The remote server returned an error: (401) Unauthorized. from what I read it's got to do with the double hop and NTLM
- Also tried using the listdata.svc API via Javascript but can't access publishing fields (images, rich html, etc) values. This one works both in Chrome and IE, but I can only get Title, and a very small set of fields.
I've added the following on the SharePoint 2010 web.config
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,POST,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Credentials" value="true" />
Also this
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
Note : both sites are using SSL (https)
I'm at the end of my wits with this. Any help is much appreciated. Thanks