Hi there,
Currently, I'm pulling the noticeboard data on to my home page using CMOS. The items are coming through fine, but I'm facing some issues.
- I'm retrieving top 3 items, but it also brings the reply.
- When you click on the link user is taken to the content of the item rather than to the page where they can reply to the post.
Please see my code below
function getEuropAnnouncements() {
$.ajax({
url: "https://test.sharepoint.com/regions/europe/_api/web/lists/GetByTitle('Noticeboard')/items?$top=3&$orderby=Created desc",
type: "GET",
headers: {"accept": "application/json;odata=verbose","content-type": "application/json;odata=verbose",
},
success: onEuropeAnnouncementQuerySucceeded,
error: onEuropeAnnouncementQueryFailed
});
}
function onEuropeAnnouncementQuerySucceeded(data) {
var listItemInfo = '';
var listName = "Noticeboard";
var url = "https://test.sharepoint.com/regions/europe";
var listDispForm = url +"/lists/"+listName+"/dispform.aspx?ID=";
$.each(data.d.results, function (key, value) {
listItemInfo += '<hr />' + '<h4 class="ms-vb2">' + value.CreatedDate+ '</h4>' + '<a href="'+listDispForm+value.ID+'" target="_blank">' + '<h5 class="ms-vb-tall">' + value.Body+ '</h5>' +'</a>' ;
});
$("#europe").html(listItemInfo);
}
function onEuropeAnnouncementQueryFailed() {
alert('Error!');
}Any help would be greatly appreciated!
Thanks
Ravi