I have successfully been using SPServices to query SharePoint lists on my site collection. Now I have a second site collection for another team that would like to see the data already hosted on my first site collection (no, we can't use the same site collection). I want to create CEWP views by querying the data from the original site collection, but the code doesn't work when I run it from the second site collection. Here's what works on the first site:
$().SPServices({
operation: 'GetListItems',
async: false,
listName: 'Requests',
CAMLViewFields: "<ViewFields>" +
"<FieldRef Name='ID' />" +
"<FieldRef Name='Title' />" +
"<FieldRef Name='Description' />" +
"<FieldRef Name='Assignee' />" +
"</ViewFields>",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Text'>" + id + "</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
id = $(this).attr("ows_ID");
title = $(this).attr("ows_Title");
description = $(this).attr("ows_Description");
assignee = $(this).attr("ows_Assignee").split(";#");
//some more formulas
});
}
});
How can I modify this to do the same thing (pull data from my original SharePoint list), but from a different site collection?
This is what I ended up getting to work to pull data on my second site collection from the first. I had to rewrite all the SPServices with ajax: