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
Dim instance As 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.

Dim mwsWebs As New List(Of SPWeb)
Dim subWebs As SPWebCollection =  webSite.Webs 
For Each web As SPWeb In subWebs
   If SPMeeting.IsMeetingWorkspaceWeb(web) Then
   End If

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.
Dim meetInfo As SPMeeting = SPMeeting.GetMeetingInformation(webSite)

' Get a collection of Meeting Workspace subsites for recurring meetings.
Dim mwsWebs As SPWebCollection = meetInfo.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.

Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Meetings

Module ConsoleApp
   Sub Main()
      Using siteCollection As SPSite = New SPSite("http://localhost")
         Using webSite As SPWeb = siteCollection.OpenWeb()

            ' Construct a query to get meetings scheduled for the next 14 days.
            Dim startDate As String = DateTime.Now.ToString("s")
            Dim endDate As String = DateTime.Now.AddDays(14).ToString("s")
            Dim query As SPQuery = 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.
            Dim subWebs As SPWebCollection = webSite.Webs
            For Each web As SPWeb In subWebs
               If SPMeeting.IsMeetingWorkspaceWeb(web) Then

                  ' A Meeting Workspace has a Meeting Series list with
                  ' information about all meetings in the workspace.
                  Dim meetings As SPList = web.Lists("Meeting Series")

                  ' Get the meeting items that fit the criteria.
                  Dim items As SPListItemCollection = meetings.GetItems(query)

                  ' Now extract useful information about each meeting.
                  For Each item As SPListItem In items
                     Dim instanceID As Integer = CType(item("InstanceID"), Integer)

                     ' Skip the master record for this workspace.
                     If instanceID > 0 Then
                        Dim url As String = web.Url + "/default.aspx?InstanceID=" + instanceID.ToString()

                        ' The EventUID field can indicate a link to the calendar.
                        Dim eventUID As String
                        Dim isLinked As Boolean = False
                        Dim isRecurring As Boolean = CType(item("fRecurrence"), Boolean)
                        If isRecurring Then
                           ' For recurring events, look in the first item's field.
                           Dim master As SPListItem = meetings.Items(0)
                           eventUID = CType(master("EventUID"), String)
                           eventUID = CType(item("EventUID"), String)
                        End If
                        If Nothing <> eventUID Then
                           isLinked = eventUID.StartsWith("STSTeamCalendarEvent")
                        End If

                        Dim dt As DateTime = CType(item("EventDate"), DateTime)

                        ' Print the title, location, date, and time of the meeting,
                        ' the URL to the workspace and optionally the calendar link.
                        Console.WriteLine(vbCrLf + "Meeting: {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 Then
                           Dim eventURL As String = CType(item("EventUrl"), String)
                           Dim parts() As String = eventURL.Split(","c)
                           Console.WriteLine("Linked to the {0} list at {1}", _
                                 parts(1).Trim(), parts(0))
                        End If
                     End If
               End If

         End Using
      End Using
      Console.Write(vbCrLf + "Press ENTER to continue...")
   End Sub
End Module

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