Query 2007 List form 2010 Environment

Sep 20, 2013 at 4:43 PM
Edited Sep 20, 2013 at 4:57 PM
I have a blog that is located in a sharepoint 2007 site (within the same domain). I also have a sharepoint 2010 site that I would like to get some of the list items from. In this case it is "http://sharepoint2007/research/blog/".

I am trying to use a content editor webpart to display the posts from this blog on my 2010 site. I was looking into the GetListItems operation however I cant figure out how to point this to an external site? Currently it doesn't appear to be doing anything....

Thanks in advance.




I apologize for the spelling, its supposed to be From 2010 enviroment, not form.
   <!-- Reference jQuery on the Google CDN -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!-- Reference SPServices on cdnjs (Cloudflare) -->
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.2/jquery.SPServices-0.7.2.min.js"></script>
   <script type="text/javascript">

       $(document).ready(function () {
           $().SPServices({
               WebURL: "http://spsite/research/blog/",
               operation: "GetListItems",
               async: false,
               listName: "Posts",
               CAMLViewFields: "<ViewFields><FieldRef Name=\"Title\" /></ViewFields>",
               completefunc: function (xData, Status) {
                   $(xData.responseXML).SPFilterNode("z:row").each(function () {
                       var status = $(this).attr("ows_Title");
                       
                       $("#list").append("<li>" + status + "</li>");
                   });
               }
           });
       });
</script>
    <ul id="list"></ul>
Here is what I believe the error I am getting is (from fiddler):
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 14.0.0.6117
X-MS-InvokeApp: 1; RequireReadOnly
Date: Fri, 20 Sep 2013 15:55:39 GMT
Content-Length: 739

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    List does not exist.
    The page you selected contains a list that does not exist.  It may have been deleted by another user.
    </errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode></detail></soap:Fault></soap:Body></soap:Envelope>
Coordinator
Sep 20, 2013 at 4:58 PM
Spelling counts! It should be webURL, not WebURL.

Depending on your network topology, you may run into other issues, but give that a go.

M.
Sep 20, 2013 at 5:09 PM
Edited Sep 20, 2013 at 5:19 PM
Tried that, now it does not appear to be making the call from what I can see...
Updated code:
$(document).ready(function () {
           $().SPServices({
               webURL: "http://spsite/research/blog/",
               operation: "GetListItems",
               async: false,
               listName: "Posts",
               CAMLViewFields: "<ViewFields><FieldRef Name=\"Title\" /></ViewFields>",
               completefunc: function (xData, Status) {
                   $(xData.responseXML).SPFilterNode("z:row").each(function () {
                       var title = $(this).attr("ows_Title");
                       
                       $("#list").append("<li>" + title + "</li>");
                   });
               }
           });
       });
Update:
I changed the code to try the following--
  1. Access a list on the same sharepoint instance in another web... worked
  2. Access a sp2010 list in another environment ....didn't work
Coordinator
Sep 20, 2013 at 5:39 PM
It's probably a cross-domain issue, then.

What about using the built in RSS feed from the 2007 blog post list?

M.
Sep 20, 2013 at 6:51 PM
I tried that but I am getting the message: "The RSS webpart does not support authenticated feeds."
Coordinator
Sep 20, 2013 at 6:55 PM
Are you mixing protocols?

M.
Sep 20, 2013 at 7:12 PM
Not sure what you mean...
Coordinator
Sep 20, 2013 at 7:18 PM
If one site is http and the other is https, that could pose an issue in addition to the cross domain thing.

M.
Sep 20, 2013 at 7:19 PM
Both sites are internal http:// sites
Sep 20, 2013 at 9:06 PM
Edited Sep 20, 2013 at 9:07 PM
OK, I got this working with the following code:
$.support.cors = true;

       $(document).ready(function () {
           $().SPServices({
               webURL: "http://spsite/research/blog/",
               operation: "GetListItems",
               async: false,
               listName: "Posts",
               crossDomain: true,
               CAMLViewFields: "<ViewFields><FieldRef Name=\"Title\" /></ViewFields>",
               completefunc: function (xData, Status) {
                   $(xData.responseXML).SPFilterNode("z:row").each(function () {
                       var title = $(this).attr("ows_Title");

                       $("#list").append("<li>" + title + "</li>");
                   });
               }
           });
       });
However I get the following message pop up:
This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?
Is there a way around this?
Coordinator
Oct 4, 2013 at 7:30 PM
You're doing a cross-domain request, so this is expected behavior.

You can try this:
  1. Go to Tools->Internet Options.
  2. Security tab.
  3. Under "Internet", click "Custom level..."
  4. Under "Misc.", check value of "Access data sources across domains".
However, you'd need to push this out as a policy to all browsers.

M.
Oct 4, 2013 at 11:26 PM

I bookmarked this library a few weeks ago because I'll probably use it one day to solve this very problem. Maybe you can try it and post back the solution if it works.


Paul




--
Paul T.

-- Sent from Mobile