Contents
1. Introduction
2. Recurrence Data
3. Create recurrence events using SOAP
4. Create recurrence events using REST
5. Fetching recurrence events using SOAP
6. Open issues
7. Hack way to find the schema of lists
in SharePoint.
8. References
1. Introduction
From the
name ‘recurrence’ events, one can guess that these are the events that are
created repeatedly. Recurrence events are the events that gets created
repeatedly based on a recurrence pattern provided.
2. Recurrence Data
Recurrence
data is the server understandable format of accepting recurrence xml. Through
recurrence xml we can create daily, weekly, monthly and yearly recurrence events
and this recurrence xml supports many other properties.
Example:
Daily recurrence event up to 5
occurrences
<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><daily
dayFrequency="1"
/></repeat><repeatInstances>5</repeatInstances></rule></recurrence>
For more information on this you can refer to http://thehightechheels.blogspot.in/2012/12/sharepoint-evenet-recurrencedata-xml.html
3. Create Recurrence events using SOAP
SOAP API: UpdateListItems
End point URL: https://<site_collection>/_vti_bin/Lists.asmx
Request Type: POST
Required headers:
Header
|
Value
|
|
Host
|
<site_collection>
|
|
SOAP Action
|
http://schemas.microsoft.com/sharepoint/soap/UpdateListItems
|
|
Content-Type
|
text/xml; charset=utf-8
|
|
Cookie
|
<cookie_value>
|
Soap request:
Below xml
request creates a recurrence event daily
until 12/12/2014 9:30 (UTC time)
<?xml
version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<UpdateListItems>
<listName>Schedules</listName>
<updates>
<Batch OnError="Continue"
DateInUtc="True">
<Method ID="1"
Cmd="New">
<Field
Name="Category"><![CDATA[Meeting]]></Field>
<Field
Name="EndDate"><![CDATA[2014-12-24T09:30:00Z]]></Field>
<Field
Name="EventDate"><![CDATA[2014-10-16T08:30:00Z]]></Field>
<Field
Name="EventType"><![CDATA[1]]></Field>
<Field
Name="fAllDayEvent">0</Field>
<Field
Name="fRecurrence"><![CDATA[1]]></Field>
<Field
Name="Location"><![CDATA[Pune]]></Field>
<Field
Name="RecurrenceData"><![CDATA[<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><daily
dayFrequency="1" /></repeat><windowEnd>2014-12-24T09:30:00Z</windowEnd></rule></recurrence>]]></Field>
<Field
Name="Description"><![CDATA[Daily
Recurrence.]]></Field>
<Field
Name="Title"><![CDATA[Creating Recurrence Event Daily by
venkat]]></Field>
<Field
Name="UID"><![CDATA[{CDE18AB6-7C2B-442A-9098-C2291A7C2104}]]></Field>
<Field
Name="WorkspaceLink"><![CDATA[0]]></Field>
<Field
Name="TimeZone"><![CDATA[2]]></Field>
</Method>
</Batch>
</updates>
</UpdateListItems>
</soap:Body>
</soap:Envelope>
4. Create recurrence events using REST
Request type: POST
URL: https://<site_collection>/_api/web/lists/getbytitle(‘Schedules’)/items
Required headers:
Header
|
Value
|
Cookie
|
Cookie_value
|
Content-Type
|
application/json;odata=verbose
|
Accept
|
application/json;odata=verbose
|
X-RequestDigest
|
Form digest value(The value that
you get after hitting <site_collection/_api/contextinfo)
|
Request body:
Below json
request creates a recurrence event monthly
last Thursday, for 5 occurances
{"Duration":3600,"EventType":1,"RecurrenceData":"\u003crecurrence\u003e\u003crule\u003e\u003cfirstDayOfWeek\u003esu\u003c/firstDayOfWeek\u003e\u003crepeat\u003e\u003cmonthlyByDay
th\u003d\"TRUE\" weekdayOfMonth\u003d\"last\"
monthFrequency\u003d\"1\"
/\u003e\u003c/repeat\u003e\u003crepeatInstances\u003e5\u003c/repeatInstances\u003e\u003c/rule\u003e\u003c/recurrence\u003e","TimeZone":2,"UID":"{63c2e5b8-84dd-4f14-8eb2-7fee412d113c}","fRecurrence":true,"AssignedToId":{"results":[24]},"AssignedToTypeIsGroupOrPerson":"Group","Description":"","EndDate":"2015-04-09T07:21:00Z","EventDate":"2014-10-30T06:21:00Z","fAllDayEvent":false,
"Location":"","__metadata":{"type":"SP.Data.ClassScheduleListItem"},"Categories":"Meeting","Title":"new
event","Id":0}
5. Fetching recurrence events using SOAP
Soap API: GetListItems
End point URL: https://<site_collection>/_vti_bin/Lists.asmx
Request Type: POST
Required Headers:
Header
|
Value
|
|
Host
|
<site_collection>
|
|
SOAP Action
|
http://schemas.microsoft.com/sharepoint/soap/GetListItems
|
|
Content-Type
|
text/xml; charset=utf-8
|
|
Cookie
|
<cookie_value>
|
Soap Request:
Below
request fetches all the recurrences events for the month of October as
mentioned in the “CalendarDate” tag of “QueryOptions”.
<?xml
version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<GetListItems
xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>Schedules</listName>
<rowLimit>500</rowLimit>
<query>
<Query>
<Where>
<DateRangesOverlap>
<FieldRef
Name="EventDate" />
<FieldRef
Name="EndDate" />
<FieldRef
Name="RecurrenceID" />
<Value
Type="DateTime">
<Month/>
</Value>
</DateRangesOverlap>
</Where>
</Query>
</query>
<viewFields>
<ViewFields>
<FieldRef
Name="FileRef" />
<FieldRef Name="EventDate" />
<FieldRef
Name="EndDate" />
<FieldRef
Name="fAllDayEvent" />
<FieldRef
Name="Author" />
<FieldRef
Name="Editor" />
<FieldRef Name="Description"
/>
<FieldRef
Name="Category" />
<FieldRef
Name="Created" />
<FieldRef
Name="Modified" />
<FieldRef
Name="Location" />
<FieldRef
Name="fRecurrence" />
<FieldRef
Name="RecurrenceData" />
<FieldRef
Name="RecurrenceID" />
<FieldRef
Name="UID" />
<FieldRef
Name="UniqueId" />
<FieldRef
Name="MasterSeriesItemID" />
<FieldRef Name="AssignedTo"
/>
<FieldRef Name="AssignedToTypeIsGroupOrPerson"
/>
<FieldRef Name="IsDeleted"
/>
<FieldRef
Name="Description" />
<FieldRef
Name="EventType" />
<FieldRef
Name="Categories" />
<FieldRef
Name="Title" />
<FieldRef
Name="Attachments" />
<FieldRef
Name="TimeZone" />
<FieldRef
Name="XMLTZone" />
</ViewFields>
</viewFields>
<queryOptions>
<QueryOptions>
<DateInUtc>TRUE</DateInUtc>
<CalendarDate>2014-10-09T18:29:59Z</CalendarDate>
<RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>
<ExpandRecurrence>True</ExpandRecurrence>
</QueryOptions>
</queryOptions>
</GetListItems>
</soap:Body>
</soap:Envelope>
Mandatory Fields in the soap request
which helps in fetching all the (Child) recurrence events:
<DateRangesOverlap>
<CalendarDate>
<ExpandRecurrence>
We can
retrieve child recurrence events for the entire year, today, week, month and
now
Today - Returns events for the current day
(The current day can be mentioned in CalendarDate tag of queryOptions.)
Year – Returns events that occur in the
year. (Now is similar to year)
Week – Returns events for the current
week (Current week date can be mentioned in the CalendarDate tag of
queryOptions.).
Example:
Assuming the
week starts from Sunday
1. If the date in the “CalendarDate” tag
mentioned is 30/10/2014, then the recurrence events returned are in the range
starts from 26/10/2014 to 31/10/2014.
2. If the date in the “CalendarDate” tag
mentioned is 23/10/2014, then the recurrence events returned are in the range
starts from 19/10/2014 to 25/10/2014.
Month - Returns events for the current
month (Current month date should be mentioned in the “CalendarDate” tag of
queryOptions).
Example:
1. If the date in the “CalendarDate” tag
mentioned is 01/02/2015, then the recurrence events returned are in the range
starts from 25/12/2014 to 07/02/2015.
2. If the date in the “CalendarDate” tag
mentioned is 01/11/2014, then the recurrence events returned are in the range
starts from 24/10/2014 to 07/12/2014
For each
month, it returns all the events starting from 24th of previous
month (in case current month has 30 days) or 25th of previous month
(in case current month has 31 days) to 7th of the next month.
6. Open issues
1. While creating recurrence events, if
the time zone of the server and client are different then there would be
definitely Daylight-saving time issues.
Example:
Consider the
SharePoint server is in (GMT-08:00) Pacific Time (US and Canada) and the client
device/setup is in (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi locations.
Now try to create events which overlaps the day light saving time of the
SharePoint server region you can observe the magic.
Let’s
observe the below table where you can see recurrence events created on
different dates. The time slot for all the event’s start date is taken as 3PM
and end date is taken as 4PM. First row denotes the events start date and end
date sent from client side and remaining all the rows shows the start date and
end date fetched from the server and converted to client’s/device’s time zone.
Event
Date:01/10/2014 – End Date: 24/12/2014
|
Event
Date: 01/10/2014 – End Date:24/04/2015
|
Event
Date:10/11/2014 – End Date:25/02/2015
|
Event
Date:16/11/2014 – End Date:24/04/2015
|
||||
01/10/2014
- 25/10/2014
|
Time
at which event gets created 3PM - 3PM
|
01/10/2014
-25/10/2014
|
Time
at which event gets created 3PM - 4PM
|
10/11/2014
- 25/02/2015
|
Time
at which event gets created 3PM - 4PM
|
16/11/2014
- 28/03/2015
|
Time
at which event gets created 3PM - 5PM
|
26/10/2014
- 24/12/2014
|
Time
at which event gets created 4PM - 4PM
|
26/10/2014
- 28/03/2015
|
Time
at which event gets created 4PM - 5PM
|
29/03/2015
- 24/04/2015
|
Time
at which event gets created 2PM - 5PM
|
||
29/03/2015
- 24/04/2015
|
Time
at which event gets created 3PM - 4PM
|
This problem
will not arise if the TimeZone of the server and client are same.
2. Not able to fetch the child
recurrence events using REST web service. We are able to get only the master
event, but not able to fetch the child recurrence events from server.
7. Hack way to find the schema of lists
in SharePoint
Steps
1. Open the SharePoint URL in the
browser and do login.
2. Go to Settings -> site settings (right
top corner).
3. Select “site libraries and lists”.
4. Select the list, for which the schema
you want to check.
5. Right click on the “List name,
description and navigation” and open in another tab.
6. Now in other tab see the URL , it
looks something like
Ex: https://
spsite.sharepoint.com/sites/subsite
/_layouts/15/ListGeneralSettings.aspx?List=%7B6AD69395-02D8-4E19-8257-73422F85872F%7D%7B6AD69395-02D8-4E19-8257-73422F85872F%7D
-> this is the encoded form of the list GUID.
8. Generate this below URL by copying
the GUID in the above step (6).
Ex: https://
spsite.sharepoint.com/sites/subsite
/_vti_bin/owssvr.dll?Cmd=ExportList&List=%7B32E4C557-009D-407A-BE37-F6D98BB1CA84%7D.
9. Copy and paste the above generated URL
in the browser and press enter. This leads to downloading the owssvr.xml file
owssvr.xml is our target xml schema file for a particular list. This schema
files tells what are the different columns supported by the list, what is the
type of the each column (i.e. text, Boolean, int16 etc.), static name and
display name of the column.
NOTE: This may not work for older versions of SharePoint.
8.
References
- http://thehightechheels.blogspot.in/2012/12/sharepoint-evenet-recurrencedata-xml.html
- http://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx
- http://blog.provokesolutions.com/daterangesoverlap-caml-query-element
- http://msdn.microsoft.com/en-us/library/office/ms436080(v=office.15).aspx
- https://social.msdn.microsoft.com/Forums/sharepoint/en-US/7c779d99-cf58-42cd-a86e-44e88c40fcd7/recurrence-display-render-failed-when-using-listsasmx-updatelistitems-method?forum=sharepointdevelopmentlegacy
- Helpful client tools to access the SharePoint server SoapUI(for windows) and REST Client extension for chrome browser.