Version

Taxonomy.getTermsByLabelWithOptions

This method is used to retrieve managed metadata from a SharePoint site. You can get all the existing terms that contain a specific text or match it exactly. Also, when the search is unsuccessful you can optionally add the term to the site.

Syntax

SPlus.Taxonomy.geTermsByLabelWithOptions (url, label, exactMatch, addIfNotFound, function (terms){
        for (var i=0; i < terms.length; i++) {//Loop the terms Array
            var term = terms [i];//Getting one of the requested terms
            //TODO: Implement what to do with the terms
        }
}, function (errorResponse){
        var error = errorResponse['error#displayValue']; //Getting the error
        //TODO: Implement how to handle errors
}, function (cancelResponse){
        //TODO: Implement how to handle a user’s cancel
});

Taxonomy.getTermsByLabelWithOptions Parameters

Parameter

Type

Description

url

String

URL to the SharePoint site.

label

String

Text (letters or words) to be searched in the existing terms.

exactMatch

Boolean

When true, the returned term must match the label exactly.

addIfNotFound

Boolean

When true and the term is not found, you add the term to the site.

onSuccess callback function

Parameter

Description

function (terms)

Success callback function to be implemented, which receives an Array with the terms.

onError callback function

Parameter

Description

function (eResponse)

Error callback function to be implemented, which receives the eResponse JavaScript Object.

onCancel callback function

Parameter

Description

function (result)

Cancel callback function to be implemented.