-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetList.js
34 lines (29 loc) · 1.21 KB
/
GetList.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function ($) {
$.SP = $.SP || {};
$.SP.Lists = $.SP.Lists || {};
$.SP.Lists.GetList = function (pathname, listName) {
var soap = '';
soap += '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">';
soap += ' <soap12:Body>';
soap += ' <GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/">';
soap += ' <listName>' + listName + '</listName>';
soap += ' </GetList>';
soap += ' </soap12:Body>';
soap += '</soap12:Envelope>';
return $.ajax({
type: "POST",
contentType: "text/xml;charset='utf-8'",
url: pathname + '/_vti_bin/Lists.asmx',
data: soap,
dataType: "xml",
beforeSend: function (xhr) {
xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetList");
}
});
}
// Example use
$.SP.Lists.GetList(L_Menu_BaseUrl, 'exampleList').done(function (data, textStatus, jqXHR) {
//you're on your own...
console.log(jqXHR);
});
})(jQuery);