I am trying to get a list id for a specific list but it just goes to the failed method
Here is my code:
var SFW = window.SFW || {};
var NBSInboxResponse = SFW.NBSInboxResponse || {};
NBSInboxResponse.getListID = function () {
'use strict';
var siteURl=url;
var clientContext = new SP.ClientContext(siteUrl);
var oWebsite = clientContext.get_web();
NBSInboxResponse.collList = oWebsite.get_lists().getByTitle('Feedback Items');
clientContext.load(NBSInboxResponse.collList, 'Include(Title, Id)');
clientContext.executeQueryAsync(NBSInboxResponse.getListSuccess, NBSInboxResponse.getListIDFailure);
};
NBSInboxResponse.getListIDSuccess = function () {
'use strict';
var listID = NBSInboxResponse.collList.get_id();
alert(listID);
};
NBSInboxResponse.getListIDFailure = function () {
'use strict';
alert('Request failed. ');
};
jQuery(document).ready(function () {
'use strict';
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', NBSInboxResponse.getListID);
});
0 commentaires:
Enregistrer un commentaire