Search code examples
sharepointcalendarfieldexpandrecurrence

Expanding of Recurring Events from a Sharepoint Calendar doesn't work for a ViewFields Query


My post is a continue of Expand Recurring Events from a Sharepoint Calendar over WebServices?

The problem is that expanding works while view fields query is null or empty. But since I set up some fields, the response doesn't match expectations.

The Lists.asmx service method,that I use, is

public System.Xml.XmlNode GetListItems(string listName, string viewName, System.Xml.XmlNode query, System.Xml.XmlNode viewFields, string rowLimit, System.Xml.XmlNode queryOptions, string webID)

When I use a viewFields value, presented below, the method doesn't expand recurrence events:

var viewFields = new XmlDocument();
viewFields.LoadXml(@"
    <ViewFields>
        <FieldRef Name='ID' />
        <FieldRef Name='Title' />
    </ViewFields>");

What's wrong with a viewFields?


Solution

  • The problem is that view fields should contain additional fields EventDate, EndDate, fRecurrence and RecurrenceData. When this items absent, expanding doesn't work. So, if you want to retrieve a Category (for example), you should use the following ViewFields query:

    <ViewFields>
        <FieldRef Name='EventDate' />
        <FieldRef Name='EndDate' />
        <FieldRef Name='fRecurrence ' />
        <FieldRef Name='RecurrenceData' />
        <FieldRef Name='Category' />
    </ViewFields>