Cant get ExpandRecurrence to work with GetListItems

Jun 9, 2010 at 3:07 PM

This is sort of driving me crazy.  I able able to get a similar query working with creating the soap envelope manually, and using .ajax to get the list items and their recurring attributes, but when i try to use SPServices and the GetListItems, it will bring back the list items, but not their recurring attributes.  I'm not much of a programmer, so any assistence would be appreciated

this code will bring back the list items, but not their recurring attributes

<script type="text/javascript">

$(document).ready(function() {
	$().SPServices({
    		operation: "GetListItems",
    		async: false,
    		listName: "{6AAD29EE-D856-4A8F-9453-252ED7B17732}",
    		viewName: "{0DF11176-F08A-45E1-955F-F9B36C8E0138}",
		// CAMLViewFields:'<Query><ViewFields><FieldRef Name="Title"/>'
             	// 		+ '<FieldRef Name="EventDate"/><FieldRef Name="EndDate"/>'
             	// 		+ '<FieldRef Name="fAllDayEvent"/><FieldRef Name="RecurrenceID"/>'
             	// 		+ '<FieldRef Name="fRecurrence"/><FieldRef Name="RecurrenceData"/></ViewFields>',
		CAMLQueryOptions: '<QueryOptions><ExpandRecurrence>TRUE</ExpandRecurrence></QueryOptions>',
    		completefunc: function(xData, Status){
           			$(xData.responseXML).find("z\\:row").each(function(){
              				var varTitle = $(this).attr("ows_Title");
               				var varSD = $(this).attr("ows_EventDate");
					var varED = $(this).attr("ows_EndDate");
					var varRecur = $(this).attr("ows_RecurrenceData");

					var liHtml = 	"<li>" + varTitle + "----" + 
							varSD + "----" +
							varED + "----" +
							varRecur + "----" +
							"</li>";
            				$("#tasksUL2").append(liHtml);
              			});

         	}
	});

});

</script>
this code will bring back both the items and their recurring attributes
        var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>Calendar</listName> \
			<query> \
			<Query> \
			</Query> \
			</query> \
			    <viewFields> \
                            <ViewFields xmlns='' > \
                               <FieldRef Name='Title' /> \
                               <FieldRef Name='EventDate' /> \
                               <FieldRef Name='EndDate' /> \
                               <FieldRef Name='fAllDayEvent' /> \
			       <FieldRef Name='RecurrenceID' /> \
			       <FieldRef Name='fRecurrence' /> \
			       <FieldRef Name='RecurrenceData' /> \
                            </ViewFields> \
			    </viewFields> \
				<queryOptions> \
				<QueryOptions xmlns='' > \
					<ExpandRecurrence>TRUE</ExpandRecurrence> \
				</QueryOptions> \
				</queryOptions> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

	$.ajax({
		url: sitePar+"/_vti_bin/lists.asmx"+"?"+Math.random()*Math.random,
		cache: false,
		async: false,
		type: "POST",
		dataType: "xml",
		data: soapEnv,
		complete: processResult,
		contentType: "text/xml; charset=\"utf-8\""
        	});
im guessing it has something to do with the xmlns setting, but im not entirely sure how to include that
Jun 9, 2010 at 3:18 PM

and thus, realizing 45 seconds after i hit submit on this dicussion, that there was a <Query> in my CAMLViewFields statement, and that if i removed that, and uncommented that section, everything works great

frustrating mistake

one question still remains though, if someone is willing to help a novice.... why would my first set of javascript produce a javascript error in IE with the "object required" error.

It displays the data, but i still get the error warning at the bottom of the IE window

Coordinator
Jun 9, 2010 at 3:58 PM

That's the kind of problem I like: the kind that solves itself!

I don't see anything obvious that would cause the "object required" error.  Which line is it reporting?

You should replace

find("z\\:row")

 with

find("[nodeName=z:row]")

See my post here:
http://mdasblog.wordpress.com/2009/11/08/sharepoints-web-services-jquery-and-the-zrow-namespace-in-safari-and-chrome/

M.

Jun 10, 2010 at 8:40 PM

IE 7 reports the error as

line: 20

char: 12043

Error: Object Required

Code: 0

At this point, it just seems to be annoying.  i wouldnt give it too much thought, as this discussion is for your library rather than my pitiful code.

thanks for the tip on the z\\:row.  thats a good thing to be aware of.

thanks for the help and the work you've done on this library

Coordinator
Jun 10, 2010 at 10:28 PM
If you're getting a JavaScript error, as opposed to a Web Services error, it's probably just a bug in your script.

M.



On Jun 10, 2010, at 16:32, "minjaeapa" <notifications@codeplex.com> wrote:

From: minjaeapa

IE 7 reports the error as

line: 20

char: 12043

Error: Object Required

Code: 0

At this point, it just seems to be annoying. i wouldnt give it too much thought, as this discussion is for your library rather than my pitiful code.

thanks for the tip on the z\\:row. thats a good thing to be aware of.

thanks for the help and the work you've done on this library