Freigeben über


SP. UserProfiles.PeopleManager.getTrendingTags-Methode (sp.userprofiles)

Ruft die am häufigsten verwendeten Tags an. getTrendingTags ist eine statische Methode.

**Letzte Änderung:**Donnerstag, 26. September 2013

**Gilt für:**apps for SharePoint | Office 365 | SharePoint Foundation 2013 | SharePoint Server 2013

SP.UserProfiles.PeopleManager.getTrendingTags(context)

Parameter

Rückgabewert

SP.UserProfiles.HashTagCollection
die 20 am häufigsten verwendeten Hash-Tags in der letzten Woche sortiert, sodass das am häufigsten verwendete Tag zuerst angezeigt wird.

Beispiel

Das folgende Codebeispiel ruft die Trend-Tags im aktuellen Kontext ab.

var trendingTags;

// Ensure that the SP.UserProfiles.js file is loaded before the custom code runs.
SP.SOD.executeOrDelayUntilScriptLoaded(getTrendingTags, 'SP.UserProfiles.js');

function getTrendingTags() {

    // Get the current client context and call the getTrendingTags static method.
    var clientContext = new SP.ClientContext.get_current();
    trendingTags = new SP.UserProfiles.PeopleManager.getTrendingTags(clientContext);

    // Load the query and send the request.
    clientContext.load(trendingTags);
    clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);
}

// This function runs if the executeQueryAsync call succeeds.
function onRequestSuccess() {

    // Get trending tag information.
    alert('There are ' + trendingTags.get_count() + ' trending tags.');
    alert('The name of the first tag is ' + trendingTags.itemAt(0).get_name());
    alert('The use count of the first tag is ' + trendingTags.get_item(0).get_useCount());
}

// This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args) {
    alert('Error: ' + args.get_message());
}

Siehe auch

Weitere Ressourcen

PeopleManager