SharePoint 2010 - Access List / Library Data Across Web Applications

We can do this using jQuery.js and SPServices.js
Only issue is that you will most likely be forced to receive a notification every time the page loads:

"this page is accessing information that is not under its control"

I found that although it's possible the solution was not ideal, but have not yet found an alternative.  However I thought I would provide it in case anyone else has a need for it.

The code below will retrieve the list item information from the Page library at http://intranet.  CAML query retrieves the most recent 4 articles from the Page library and the last line appends the HTML statement to the page.

The HTML statement that is created grabs the value of the FileRef Field and places it inside a div.

----------------------------------------------

$(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    async: false,
    webURL: "http://intranet",
    listName: "Pages",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='ArticleStartDate' /><FieldRef Name='PublishingRollupImage' /><FieldRef Name='FileRef' /></ViewFields>",
    CAMLQuery: "<Query><OrderBy><FieldRef Name='ArticleStartDate' Ascending='FALSE' /></OrderBy></Query>",
    CAMLRowLimit: 4,
    completefunc: function (xData, Status) {
      $(xData.responseXML).find("[nodeName=z:row]").each(function() {
        var liHtml = "<div id='div>" + $(this).attr("ows_FileRef") + "</div>";
        $("#tasksUL").append(liHtml);
      });
    }
  });




Comments

  1. but how do we suppress this security message from browser...?

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Copy/Duplicate a Table and Columns in a Dataverse Environment

Export Group Membership From Active Directory Using Power Query

Microsoft Flow - Apply To Each Limitation (5000 items)