GetListItems on a Calendar / CAMLViewFields ignored

Jan 31, 2012 at 5:10 AM

Hi all,

Is there anything special about the way we query a SharePoint calendar using getlistitems? I can't seem to return values from the Location column (or any custom column), they all return as undefined. Things like ID, start time, title etc are working fine. I've noticed that xData.responseXML object contains the same set of fields nomatter what, essentially ignoring the CAMLViewFields statement.  There may be something Microsoft's documentation, just wondering if anyone had any thoughts?

Coordinator
Jan 31, 2012 at 5:19 PM

If GetListItems is "ignoring" the CAMLViewFields you are providing, then my guess is that it's something as simple as a spelling mistake, as it should "take". Make sure that your option is spelled *exactly* "CAMLViewFields".

The fields aren'ty actually returned as undefined from the sounds of it; they just aren't present.

M.

Jan 31, 2012 at 11:15 PM

Yeah, I meant that they aren't present in the xml output and so the variables are undefined, my bad. Checked the spelling and it's all in order so the mystery continues. I'll post back if I discover anything noteworthy.

Feb 1, 2012 at 3:00 AM

I've noticed this before too.  It happened when there wasn't any data in the column at all.  I've also seen it when I use just a CamlQuery and I don't specify *any* CamlViewFields.  Care to post your code?

 

Cheers,

Matt

Feb 1, 2012 at 3:14 PM
Like Matt, it is also my experience that if hte column is not populated with data, it is not returned in the response for that particular row, regardless if I defined that column in the CAMLViewFields

_________
Paul T


Coordinator
Feb 1, 2012 at 5:11 PM

Yes, you will certainly see instances where the column simply isn't present in the XML. SharePoint populates the XML sparsely, so if a column is optional and has never been given a value, it may not be an attribute on the z:row element.

M.

Feb 1, 2012 at 9:05 PM

Yup, right on all counts. I was expecting an empty element in the xml if the column was empty, but now i know better. Thanks to all of you for your help.