Get all items of a List in Meeting Workspace
Wednesday, July 13, 2011 | Author: vrey
If you have tried to program with Meeting WorkSpace, you will find that any query to GetItems from the SPList will return only the records of that MeetingInstanceID.
SPList.ItemCount will give the count of all the items in the list
SPList.Items.Count will give the count of items for the current meeting instance
Suppose you want a functionality something like this..

All Meetings
All Meetings
To achieve this you have to pass a special value  i.e. -1  to the MeetingInstanceID property of the Query. This will return all the records of the list.
private void AddOpenActionItems(SPItemEventProperties properties)
        {
            DisableEventFiring();
            try
            {
                using (SPSite spSiteColl = new SPSite(properties.WebUrl))
                {
                    using (SPWeb web = spSiteColl.OpenWeb())
                    {
                        // Get all the open items for the current project selected
                        // from the Action Items List
                        SPList listActionItems = web.Lists["Action Items"];

                        SPQuery OpenActionItemsQry = new SPQuery();
                        OpenActionItemsQry.MeetingInstanceId = -1; // required to get all meeting items
                        OpenActionItemsQry.Query = “<Where><Eq><FieldRef Name=’Project’ /><Value Type=’Text’>abc</Value></Eq></Where>;
                        SPListItemCollection ExistingOpenItemCollection = listActionItems.GetItems(OpenActionItemsQry);

                        if (ExistingOpenItemCollection != null && ExistingOpenItemCollection.Count > 0)
                        {
                            foreach (SPListItem ExistingOpenItem in ExistingOpenItemCollection)
                            {
                                // …
                            }
                        }
                    }
                }
            }
            finally { EnableEventFiring(); }
        }

|
This entry was posted on Wednesday, July 13, 2011 and is filed under . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

1 comments:

On August 12, 2011 at 12:47 AM , - said...

mantap de... ;)