<script type="text/javascript">
window.onload = load;
function load() {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveAllListProperties);
}
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveAllListProperties);
}
var collListItem;
function retrieveAllListProperties() {
var clientContext = new SP.ClientContext.get_current();
var oWebsite = clientContext.get_web();
var collList = oWebsite.get_lists().getByTitle('OoredooAnnouncement');
var clientContext = new SP.ClientContext.get_current();
var oWebsite = clientContext.get_web();
var collList = oWebsite.get_lists().getByTitle('OoredooAnnouncement');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'ID\' Ascending=\'FALSE\'/></OrderBy></Query><RowLimit>4</RowLimit></View>');
camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'ID\' Ascending=\'FALSE\'/></OrderBy></Query><RowLimit>4</RowLimit></View>');
this.collListItem = collList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
}
function onQuerySucceeded() {
var listInfo = '';
var count = 0;
var listEnumerator = collListItem.getEnumerator();
var listInfo = '';
var count = 0;
var listEnumerator = collListItem.getEnumerator();
while (listEnumerator.moveNext()) {
var oList = listEnumerator.get_current();
listInfo += 'Title: ' + oList.get_item("Title");
count++;
$("#AnnouncementTitle" + count).text(oList.get_item("Title"));
$("#AnnouncementDesc" + count).text(oList.get_item("Values"));
var oList = listEnumerator.get_current();
listInfo += 'Title: ' + oList.get_item("Title");
count++;
$("#AnnouncementTitle" + count).text(oList.get_item("Title"));
$("#AnnouncementDesc" + count).text(oList.get_item("Values"));
}}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
No comments:
Post a Comment