Thursday, November 6, 2014

Getting SharePoint List Items from Picture Library in CEWP

Step 1:

Add CEWP on page and GO to Edit Webpart and then click on html on top of the page and Add Jquery and SPservice Reference

<script src="/sites/BGL/SiteAssets/jquery-2.1.1.js" type="text/javascript"></script><script src="/sites/BGL/SiteAssets/jquery.SPServices-2014.01.js" type="text/javascript"></script><script type="text/javascript">

Step 2:-

Add below simple code to get the list items, Don't forget to provide your listName

$(document).ready(function(){
alert("CEWP inside");
            $().SPServices({
                operation: "GetListItems",
                async: false,
                listName: "BGLBanners",
                CAMLRowLimit: 6,
                completefunc: function (xData, Status) {
  $(xData.responseXML).SPFilterNode("z:row").each(function() {
         var _url = '/' + $(this).attr("ows_RequiredField");
  alert(_url);
   var img_Size= $(this).attr("ows_ImageSize");
               alert(img_Size);
       
      });            
                }
            });
        });
</script>


All the best :)

No comments:

Post a Comment

Building Secure Azure AI Foundry Agents with Managed Identity

  The credential problem nobody wants to own Every team that connects an Azure AI Foundry agent to Microsoft Graph, SharePoint, Outlook, or...