lundi 8 décembre 2014

Get the last rated item in a SharePoint list



we have a SharePoint list with social rating feature enabled. On the homepage I want to display the "Latest Voted Item" of that list.


Is it possible to get the last rated items in a SharePoint list (via JSOM)?


One (propably slow) idea was to get all items of the list, iterate and get the rating with the youngest DateTime. But it doesn't look like ratings are stored with timestamp.


All I know to get is following:



[...]
while (itemsEnumerator.moveNext()) {
var oItem = itemsEnumerator.get_current();

// Returns a comma separated list of all single ratings
oItem.get_item('Ratings');

// Returns an array of all user objects rated on this item
oItem.get_item('RatedBy');
}
[...]


Is there a way to get the timestamps of a rating? Or if not, is there a better way to get the item with the newest rating?








0 commentaires:

Enregistrer un commentaire