views:

1011

answers:

2

I want to get all items from a specific list in recurring meeting workspace. I tried to execute the following CAML:

<Query>
   <Where>
      <IsNotNull>
         <FieldRef Name='ID' />
      </IsNotNull>
   </Where>
</Query>

But it only displays data for the upcoming meeting.

However when I open list, from actions menu I can choose to display data from all meetings. That makes me think it is possible. I know I can convert the list to series items so they appear in all meetings, but it is not that I want.

A: 

I think the default view of the list displays only the upcoming meeting list items, and not the meeting list items in the past.

If you don't specify the view on which you run your CAML query, it will retrieve all the items from the default view. Use the All Items view (All Events view if it is a calendar) instead of the default view, also set the SPQuery.ExpandRecurrence property to true.

ashwnacharya
Pity, but SPQuery.ExpandRecurrende property won't help.As well as AllItems view won't show items from all recurring meetings, but only this one. There are totally 3 views available: Attendees (AllItems.aspx), Manage Attendees (ManageA.aspx) and default.aspxHowever when getting the data from browser I see that it adss a string to url - InstanceID=ALL and that returns all the data...
Janis Veinbergs
+2  A: 

Yeehaaw!

Finally I found a solution! SPQuery class has a property MeetingInstanceId, which one you can assign a value of a specific InstanceID (for example 20090615 for 15 June 2009 items) or to query all items you must assign it SPMeeting.SpecialInstance enum value (don't forget to cast it to int).

Then you just execute your query to get items from whatever workspace you want.

Oh, and don't forget

using Microsoft.SharePoint.Meetings;

Sample code:

using(SPSite site = new SPSite(<enter your workspace url>))
using (SPWeb web = site.OpenWeb())
{
    SPMeeting meeting = SPMeeting.GetMeetingInformation(web);

    SPQuery query = new SPQuery();
    query.MeetingInstanceId = (int)SPMeeting.SpecialInstance.AllButSeries;
    query.Query = @"<Query>
                       <Where>
                          <IsNotNull>
                             <FieldRef Name='ID' />
                          </IsNotNull>
                       </Where>
                    </Query>";

    SPList list = web.Lists[<enter your list>];
    foreach (SPListItem item in list.GetItems(query))
    {
        Console.WriteLine(item[item.Fields.GetFieldByInternalName("Title").Id]);
    }
}

It took so much time for this to find. Probably not too much info on the net for this issue or I didn't choose the right keywords, but anyway credit to this source for getting in the first place for keywords "get all list items sharepoint workspace recurring".

I hope this helps others.

Janis Veinbergs