Unable to access list with GetListItems or GetList

Oct 7 at 5:05 PM
End result I am hoping for is to access the Column Headers (names of the Fields) and the Filters for each Column (or enough data to recreate the lists of filters for each column, if I cannot access the filter lists directly), and then eventually I will need to access individual list items. Even the basic functions do not seem to be working for me though:
function getPlaylistMetadata() {
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "M&S Playbook",
        CAMLViewFields: "<ViewFields Properties='True' />",
        completefunc: function (xData, Status) {
            console.log(xData.responseText);
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                    var description = $(this).attr('ows_Description');
                    console.log( "Type: " + $(this).attr("Type") + " StaticName: " + $(this).attr("StaticName") )
            });     
        }   
    });
};
Stepping through in the debugger, the xData.responseText is an empty string and xData.statusText = "Bad Request". Note that I have tried - listName: "MS%20Playbook" - (MS%20Playbook is in the URL for directly accessing the list through sharepoint) and - listName: "MS%20Playbook" - (because I thought there might be an issue with how " " is represented), and both of these yield "List does not exist" in the responseText.

Additionally the debugger seems to skip the SPServices block completely in
function getPlaylistMetadata() {
    console.log("Entered getPlaylistMetadata")
    $().SPServices({
        operation: "GetList",
        listName: "M&S Playbook",
        completefunc: function (xData, Status) {
            console.log(xData.responseText);
            $(xData.responseXML).find("Fields > Field").each(function() {
                    var $node = $(this);
                    console.log( "Type: " + $node.attr("Type") + " StaticName: " + $node.attr("StaticName"))
            });     
        }   
    });
};
Coordinator
Oct 10 at 12:15 AM
Edited Oct 10 at 12:18 AM
You're not showing all your code, but my guess is the issue is the & in your listName. You'll probably need to escape that as
&amp;
In other words:
"M&amp;S Playbook"
All SOAP calls send text and get text back over HTTP, and you need to be careful with special characters. It's always a better practice to use only "regular" characters in list names.

You might want to look at the function SPGetListItemsJson instead. With it, you'll get the list schema as well as the data in one call. No call will get you what you call the "filters", though. You'll need to build that yourself from the data.

Finally, I have to assume that somewhere you are calling getPlaylistMetadata(). Otherwise, as you intimate, the SPServices call will never be called.

M.
Oct 11 at 5:12 PM
sympmarc wrote:
You're not showing all your code, but my guess is the issue is the & in your listName. You'll probably need to escape that as
&amp;
In other words:
"M&amp;S Playbook"
All SOAP calls send text and get text back over HTTP, and you need to be careful with special characters. It's always a better practice to use only "regular" characters in list names.

You might want to look at the function SPGetListItemsJson instead. With it, you'll get the list schema as well as the data in one call. No call will get you what you call the "filters", though. You'll need to build that yourself from the data.

Finally, I have to assume that somewhere you are calling getPlaylistMetadata(). Otherwise, as you intimate, the SPServices call will never be called.

M.
 "M&amp;S Playbook"
This works better for GetListItems, but I'm still having issues.
I was not the one that set up the SharePoint site or the list in question, otherwise I already would have altered the list name. Is it possible that the SharePoint site was set up to only allow specific SPServices calls through, because even with using "M&S Playbook", the GetList SPServices call is still skipped (but "Entered getPlaylistMetadata" is logged to the console)?
Additionally, I attempted the following code:
function getPlaylistMetadata() {
    var fullListData;
    var fullListDataGrab = $().SPServices.SPGetListItemsJson({
        listName: "M&amp;S Playbook",   
    });
    $.when(fullListDataGrab).done(function() {
        fullListData = this.data;
    });
    console.log(" " + fullListData + " ")
};
The debugger stops at the line
var fullListDataGrab = $().SPServices.SPGetListItemsJson({
The error is "Object doesn't support property or method 'SPGetListItemsJson'"

Meanwhile with GetListItems, the only SPServices call that seems to even partially work, the "console.log(xData.responseText);" line returns:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<rs:data ItemCount="52">
<z:row ows_ContentTypeId='0x010003A350016145F8428BC12703BB3C45A5' ows_Title='[Row Title for ID 68]' ows_LINK='https://[correct site]/MS%20Tool%20Descriptions/[Properly escaped for URL name of powerpoint listed in indicated folder].pptx, [team name linked to generation of said ppt]' ows_LinkTitleNoMenu='[Row Title for ID 68]' ows_LinkTitle='[Row Title for ID 68]' ows_LinkTitle2='[Row Title for ID 68]' ows_[COLUMN_x0020_TITLE]='1;#P

Notes:
Content in [ ] brackets have been edited for the sake of those that created the list.
As far as I know the PowerPoint file referred to in ows_LINK is not directly connected to List, though the content in the PowerPoint was used to generate some of the data in the list.
"COLUMN TITLE" as referenced by "ows_[COLUMN_x0020_TITLE]=" is a valid column title for the list
The "Row Title for ID 68" is the correct List Item entry for the first column of the list; the list starts at ID 68, I do not know what happened to IDs 1-67.
Oct 11 at 7:54 PM
Edited Oct 11 at 9:12 PM
totl wrote:
Meanwhile with GetListItems, the only SPServices call that seems to even partially work, the "console.log(xData.responseText);" line returns:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<rs:data ItemCount="52">
<z:row ows_ContentTypeId='0x010003A350016145F8428BC12703BB3C45A5' ows_Title='[Row Title for ID 68]' ows_LINK='https://[correct site]/MS%20Tool%20Descriptions/[Properly escaped for URL name of powerpoint listed in indicated folder].pptx, [team name linked to generation of said ppt]' ows_LinkTitleNoMenu='[Row Title for ID 68]' ows_LinkTitle='[Row Title for ID 68]' ows_LinkTitle2='[Row Title for ID 68]' ows_[COLUMN_x0020_TITLE]='1;#P

Notes:
Content in [ ] brackets have been edited for the sake of those that created the list.
As far as I know the PowerPoint file referred to in ows_LINK is not directly connected to List, though the content in the PowerPoint was used to generate some of the data in the list.
"COLUMN TITLE" as referenced by "ows_[COLUMN_x0020_TITLE]=" is a valid column title for the list
The "Row Title for ID 68" is the correct List Item entry for the first column of the list; the list starts at ID 68, I do not know what happened to IDs 1-67.
However, once the debugger is into the "$(xData.responseXML).SPFilterNode("z:row").each(function() {" portion of the code:
$(this).attr('ows_Description') is undefined (and thus 'description' is likewise undefined).
"this" appears to be a largely undefined [object IXMLDOMElement], such that the console logs ~52 lines of:
"Type: undefined StaticName: undefined"
Coordinator
Oct 11 at 10:22 PM
Check the documentation for SPGetListItemsJson. I'm not sure what you're missing, but you do have a trailing comma on the listName line, which will cause problems in some browsers.

Your responseText looks valid, and you're getting items back. If a Description has no value, you won't get anything in the results, thus the undefined you're seeing.

M.
Oct 11 at 11:28 PM
Edited Oct 11 at 11:28 PM
sympmarc wrote:
Check the documentation for SPGetListItemsJson. I'm not sure what you're missing, but you do have a trailing comma on the listName line, which will cause problems in some browsers.
With or without the trailing comma, I get the same errors, the only differences between my code and the example provided in the documentation you refer to are variable names used (shouldn't matter) and less options used/referenced in my code:
CAMLQuery: Do I need to include a CAML Query when I want the call to return the entirety of the data from the list?
changeToken: I cannot see how referencing an alternate change token would affect whether the SPService object supports the 'SPGetListItemsJson' property or method.
mappingOverrides: It is possible that I need to do some mapping Overrides, but I would think I would be getting a different error if that were the case.

sympmarc wrote:
Your responseText looks valid, and you're getting items back. If a Description has no value, you won't get anything in the results, thus the undefined you're seeing.

M.
I don't understand this. Why would there be no description value for a 15x52 list mostly filled in with data?
Since, even with your considerable and appreciated help, neither GetList nor SPGetListItemsJson seems to be working, how would I use the, at least somewhat functional GetListItems to access the Column Headers (names of the Fields) and enough of the data to recreate the lists of filters for each column?
Coordinator
Oct 14 at 1:41 AM
@totl:

I'm really not sure what's not working for you. You seem to be getting data back (Tue at 2:54 PM), so what's the actual issue?

M.