SPMeeting Class

Provides methods and properties that can be used to work with a Meeting Workspace.


Namespace:  Microsoft.SharePoint.Meetings
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public class SPMeeting

A Meeting Workspace is a Web site that can be used to gather all the information and materials that are needed for one or more meetings. This can include information about the date, time, and place of the meeting, a library of shared documents, and lists of agenda items and objectives for the meeting, tasks assigned, and decisions taken.

You can create a Meeting Workspace site by calling the Add method of the collection that is returned by the Webs property of a Web site. The following table includes a list of templates that can be used with the Add method.


Workspace Definition


Basic Meeting Workspace


Blank Meeting Workspace


Decision Meeting Workspace


Social Meeting Workspace


Multipage Meeting Workspace

You can retrieve a list of existing Meeting Workspace sites in either of two ways. The first way is simply to iterate through all subsites of the current Web site and test each one by calling the static IsMeetingWorkspaceWeb(SPWeb) method. This technique is illustrated in the following example.

List<SPWeb> mwsWebs = new List<SPWeb>();
SPWebCollection subWebs = webSite.Webs;
foreach (SPWeb web in subWebs)
   if (SPMeeting.IsMeetingWorkspaceWeb(web))

Another technique is useful when you intend to create a new instance of a meeting in an existing Meeting Workspace. The key task in this situation is to find an existing site that can accommodate another meeting. Single-instance meetings are easy to create because there is no limit on how many single-instance meetings a Meeting Workspace can host. However, a recurring meeting must have a Meeting Workspace of its own. If you want a workspace for a recurring meeting, you need to find one that is empty—one that has no meetings of any kind. (More than likely, this is a newly created Meeting Workspace site.)

The GetWorkspacesToLinkTo(Boolean) method provides a solution. Begin by calling the static GetMeetingInformation(SPWeb) method, passing the SPWeb object that represents the parent Web site as an argument. Then call the GetWorkspacesToLinkTo method, passing false to get subsites that can host single-instance meetings or true to get subsites that are available to host a recurring meeting (that is, empty workspace sites).

The following example demonstrates the technique.

// Create a meeting object.
SPMeeting meetingInfo = SPMeeting.GetMeetingInformation(webSite);

// Get a collection of Meeting Workspace sites for recurring meetings.
SPWebCollection mwsWebs = meetingInfo.GetWorkspacesToLinkTo(true);

After you have a Meeting Workspace site, the next task is to add a meeting to it. The SPMeeting class has two methods that can help you accomplish this. The LinkWithEvent method adds a meeting to a Meeting Workspace and then links the meeting to an item in an events list, such as the Calendar list that is a feature of the standard Team Site configuration.

If you are working with a scheduling application that maintains its own appointment calendar, the Add() method is better suited to your needs. One overload of the Add method imports meeting information that is in the format defined by RFC 2445, "Internet Calendaring and Scheduling Core Object Specification (iCalendar)". Many scheduling applications can export event data in iCalendar format, including the Microsoft Windows Calendar.

The Add method adds a meeting to a specified workspace and returns the meeting instance identifier (ID). The method does not link the meeting to an appointment on the Calendar list. However, you could use the instance ID to create a URL for the meeting, as SharePoint Foundation does, by appending it to a query string.



The following example is a console application that finds all the Meeting Workspace subsites that are associated with a Web site. For each workspace that it finds, the example application gets a list of meetings that are scheduled over the next 14 days. The application then prints information about each meeting to the console in the following format.

Meeting: Team Meeting
Location: Conf Room
Date: Wednesday, March 04, 2009
Time: 10:00 AM
Workspace URL: http://spvm/Team Meeting/default.aspx?InstanceID=20090304
Linked to the Calendar list at http://spvm/Lists/Calendar

Note that the last line is optional, depending on whether the meeting is linked to a SharePoint Foundation events list.

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Meetings;

namespace Test
   class ConsoleApp
      static void Main(string[] args)
         using (SPSite siteCollection = new SPSite("http://localhost"))
            using (SPWeb webSite = siteCollection.OpenWeb())
               // Construct a query to get meetings scheduled for the next 14 days.
               string startDate = DateTime.Now.ToString("s");
               string endDate = DateTime.Now.AddDays(14).ToString("s");
               SPQuery query = new SPQuery();
               query.ViewXml = 
                  "<View><Query><Where><And>" +
                  "<Geq><FieldRef Name='EventDate'/><Value Type='DateTime'>" + startDate + "</Value></Geq>" +
                   "<Leq><FieldRef Name='EventDate'/><Value Type='DateTime'>" + endDate + "</Value></Leq>" +

               // Find all Meeting Workspace sites.
               SPWebCollection subWebs = webSite.Webs;
               foreach (SPWeb web in subWebs)
                  if (SPMeeting.IsMeetingWorkspaceWeb(web))
                     // A Meeting Workspace has a Meeting Series list with
                     // information about all meetings in the workspace.
                     SPList meetings = web.Lists["Meeting Series"];

                     // Get the meeting items that fit the criteria.
                     SPListItemCollection items = meetings.GetItems(query);

                     // Now extract useful information about each meeting.
                     foreach (SPListItem item in items)
                        int instanceID = (int)item["InstanceID"];

                        // Skip the master record for this workspace.
                        if (instanceID > 0)
                           string url = web.Url + "/default.aspx?InstanceID=" + instanceID.ToString();

                           // The EventUID field can indicate a link to the calendar.
                           string eventUID;
                           bool isLinked = false;
                           bool isRecurring = (bool)item["fRecurrence"];
                           if (isRecurring)
                              // For recurring events, look in the first item's field.
                              SPListItem master = meetings.Items[0];
                              eventUID = (string)master["EventUID"];
                              eventUID = (string)item["EventUID"];
                           if (null != eventUID)
                              isLinked = eventUID.StartsWith("STSTeamCalendarEvent");
                           DateTime dt = (DateTime)item["EventDate"];

                           // Print the title, location, date, and time of the meeting,
                           // the URL to the workspace and optionally the calendar link.
                           Console.WriteLine("\nMeeting: {0}", item.Title);
                           Console.WriteLine("Location: {0}", item["Location"]);
                           Console.WriteLine("Date: {0}", dt.ToLongDateString());
                           Console.WriteLine("Time: {0}", dt.ToShortTimeString());
                           Console.WriteLine("Workspace URL: {0}", url);
                           if (isLinked)
                              string eventURL = (string)item["EventUrl"];
                              string[] parts = eventURL.Split(',');
                              Console.WriteLine("Linked to the {0} list at {1}",
                                 parts[1].Trim(), parts[0]);
         Console.Write("\nPress ENTER to continue...");

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.