0

Does any know how to pull published pages using SPServices ?

I am able pull using Object model, but site seems slower

using (SPSite oSite = new SPSite(SPContext.Current.Web.Site.Url))
{
    using (SPWeb oWeb = oSite.OpenWeb())
    {
        PublishingPageCollection oPubPages = PublishingWeb.GetPublishingWeb(oWeb).GetPublishingPages();
        foreach (PublishingPage oPage in oPubPages)
        {
        }
    }
}
  • Can you post the Object Model code? Also I don't think you can get an performance gain with WebService calls. – Amal Hashim Dec 30 '14 at 21:28
  • What do you want to do with them? It's just a GetListItems operation, pass in your desired CAML to retrieve what you want, spservices.codeplex.com/…. – Eric Alexander Dec 30 '14 at 21:56
  • I am looking to pull only published pages through Sp Services – raky Dec 30 '14 at 22:01
0

The basic equivalent would be:

 $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Pages",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        //do something with each page
      });
    }
  });

You'd most likely want to include a CAMLQuery to get the specific pages you want.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.