Set Time Interval with custom fields in generic list with view(SPViewCollection.SPViewType.C alendar)

I need to set time interval range with custom date fields in sharepoint view SPViewCollection.SPViewType.Calendar. How to do that?

My code is this:

 System.Collections.Specialized.StringCollection viewFields = new System.Collections.Specialized.StringCollection();
        viewFields.Add("FechaInicio");
        viewFields.Add("FechaFin");

        string query = @"<Query>
                            <Where>
                                <DateRangesOverlap>
                                    <FieldRef Name=""FechaInicio"" />
                                    <FieldRef Name=""FechaFin"" />
                                    <FieldRef Name=""RecurrenceID"" />
                                        <Value Type=""DateTime"">
                                            <Week />
                                        </Value>
                                </DateRangesOverlap>
                            </Where>
                        </Query>";

        SPView newView = reserva.Views.Add("CalendarView", viewFields, query, 0, true, true, SPViewCollection.SPViewType.Calendar, false);

"FechaInicio" and "FechaFinal" ara datetime fields in my generic list.

Thanks.

February 9th, 2015 6:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics