Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Sharepoint RestAPI

$
0
0

Dear All,

      I am display GoodNews from the share point list using Rest API in share point homepage.Now i want to add expiry column on share point list based on expiry date GoodNews should not shown in share point home page.Kindly help me how to achieve this below is older code without expiry column and condition.

function GoodNews()
{
$.ajax({
        url: siteUrl  + "/_api/web/lists/getByTitle('GoodNews')/items?$top=2&$orderby=Modified desc",
        type: "GET",
        headers: {
            "accept": "application/json;odata=verbose",
            "content-type": "application/json;odata=verbose",
        },
        success: function(GoodNewsdata){
        $.each(GoodNewsdata.d.results,function(index,value){
   var datevalue=datetoISODate(new Date(value.DateCustom));
         var desc=value.Description;
        var shortdesc="";
        if(desc!="" && desc.length > 53)
        {
        shortdesc=desc.substring(0,53)+"...";
        }
        else
        {
        shortdesc=desc;
        }
        var ListDisplayItem=siteUrl+"/Lists/GoodNews/DispForm.aspx?ID="+value.ID;
            $("#dvGoodNews").append('<div class="news-list"><span>'+datevalue+'</span><h4>'+value.Title+'</h4><p class="pophide">'+shortdesc+'</p><div class="news-description">'+desc+'</div></div>');
        });
                      
        if(GoodNewsdata.d.results.length>0){
        var allItemUrl=siteUrl  +"/Lists/GoodNews/AllItems.aspx";
        $("#dvGoodNews").append('<a href="'+allItemUrl+'" class="view-btn" target="_blank">View All</a>');

        }
},
error:function(GoodNewsData){

}
});
}

Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>