Say you want to verify that an ID exists in
"Body": {
"GetListCollectionResponse": {
"GetListCollectionResult": {
"Lists": {
"List": [
{
"ID": "{B8B000CC-EB90-4B3D-9A44-79B8A9CFCAAC}",
"RequireCheckout": "False",
"EnableMinorVersion": "False",
...
Verify existence with the following function:
ListExists = function(listGuid) { //search spsvcListColXmlJson for match
var arr = JSONSelect.match(":has(:root > .ID:val(\""+listGuid+"\"))",
spsvcListColXmlJson.Body.GetListCollectionResponse.GetListCollectionResult.Lists);
var retval = arr.length>0;
return retval;
};
Test:
test('List Guid found in Lists collection', function() {
ok(ListExists("{B8B000CC-EB90-4B3D-9A44-79B8A9CFCAAC}"),"list should exist");
});
No comments:
Post a Comment