0

Have LIST created under one site, can the same LIST be used to fetch data from other site using CAML Query.?

eg:

Consider a LIST "xxx" created under SitePages/AAA/Lists/

Can i access the LIST "xxx" from other site i.e SitePages/BBB/

To Summarize, Is it possible to access the LIST across parent and child sites, vice-versa.

Thanks in advance

KrankyCode
  • 441
  • 1
  • 8
  • 24
  • See this question: http://stackoverflow.com/questions/1374137/how-to-query-data-in-sharepoint-from-multiple-lists – Chloraphil Apr 05 '13 at 14:53

2 Answers2

0

Yes it's possible. The only condition is to have the same domain (for example http://mydomain.com/SitePages/AAA/ and http://mydomain.com/SitePages/BBB/).

Then, with SharepointPlus library (http://aymkdn.github.io/SharepointPlus/symbols/%24SP%28%29.list.html#.get) that is a JavaScript API that would be (if you are on the http://mydomain.com/SitePages/AAA/* site) :

$SP().list("ListName","http://mydomain.com/SitePages/BBB/").get({
  fields:"Title"
}, function getData(data) {
  for (var i=0; i<data.length; i++) console.log(data[i].getAttribute("Title"));
});
AymKdn
  • 3,327
  • 23
  • 27
0

Yes, as long as they are under the same site collection, you can use SPSiteDataQuery Link to MSDN SPSiteDataQuery SPSiteDataQuery allows you to set the Site collection under which to search the lists.