Can't limit columns in dataset returned by GetListItems

May 21, 2014 at 1:53 PM
Hi all,
Is there any possible way for GetListItems to not include ows_MetaInfo, ows_ModerationStatus, ows_Level, ows_ID, ows_UniqueID, ows_owshiddenversion, ows_FSObjTtype, ows_Created_x0020_Date, ows_Created, ows_PermMask, ows_Modified, ows_FileRef, ows_FileLeafRef?

GetListItems is returning a lot of extra row data by including columns that I don't want returned. I have tried various solutions via ViewName/CAMLQueryOptions/CAMLViewFields to reduce the size of each z:row but nothing is working. I know my View GUID is correct and I'm aware of CAML options overriding ViewName settings. The code below is used in a SP2010 webpart page that includes an InfoPath Form Web Part.

I would like someone to confirm that it is possible to return a dataset with only the exact columns/attr desired. Changed some code to xxxxx for privacy :)

Any guidance or support is greatly appreciated and will support our troops :)
//All css/js links have been validated and are working
<script type="text/javascript" src="xxxxx/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="xxxxx/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" src="xxxxx/jquery.SPServices-2013.01.min.js"></script>
<link rel="stylesheet" type="text/css" href="xxxx/jquery-ui-1.8.16.custom.css"/>
<script type="text/javascript">
    window.onload = function() {
             //Fixes js in InfoPath form modals. Tested OK
         window.setTimeout(readyCall, 2000);    

        function readyCall(){
            var PortLevel = []; 
                        var UID;

                operation: "GetListItems",
                listName: "xxxxx Data",
                webURL: "sites/xxxxx/xxxxx",
                viewName: "{312AD62C-CA85-4883-8CF3-0B3CC343A538}", CAMLQueryOptions: "<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>",
                async: false,
                completefunc: function (xData, Status) {
                    $(xData.responseXML).SPFilterNode("z:row").each(function() {
                        PortLevel.push($(this).attr("ows_UID") + ":" + $(this).attr("ows_LinkTitle") + " (" + $(this).attr("ows_Lead_x0020_Name") + ")");
                    $( ".dataDone" ).append( "<h1>Data finished loading</h1>" );

                        //Below is jquery autocomplete on an InfoPath form. Everything works once the dataset is finally loaded.
                    source: PortLevel,
                    minLength: 3,
                    select: function(e, ui) {
                        UID = ui.item.value.substring(0,9);
May 21, 2014 at 2:25 PM
Quick answer: no.

There are some columns that are returned regardless what we ask for and there is nothing we can do about it. By using CAMLViewFields, we can at least only retrieve the columns we've created that we want, but that's the best we can do.

May 21, 2014 at 2:43 PM
Thanks Marc, you're awesome. Congrats on being a Top 25 influlencer!
I'll retire this thread.