다음을 통해 공유


SPMeeting.GetWorkspacesToLinkTo Method

Gets Meeting Workspace sites that are available to host a new instance of a meeting.

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

Syntax

'Declaration
Public Function GetWorkspacesToLinkTo ( _
    bToLinkRecurringMeeting As Boolean _
) As SPWebCollection
'Usage
Dim instance As SPMeeting
Dim bToLinkRecurringMeeting As Boolean
Dim returnValue As SPWebCollection

returnValue = instance.GetWorkspacesToLinkTo(bToLinkRecurringMeeting)
public SPWebCollection GetWorkspacesToLinkTo(
    bool bToLinkRecurringMeeting
)

Parameters

  • bToLinkRecurringMeeting
    Type: System.Boolean

    Pass false to get a collection of workspaces available for single-instance meetings. Pass true to get a collection of workspaces available to host a recurring meeting.

Return Value

Type: Microsoft.SharePoint.SPWebCollection
A collection of Meeting Workspace sites. The collection that is returned includes only sites that you have permission to add meetings to.

Remarks

A single-instance meeting can be added to a Meeting Workspace site that hosts any number of other single-instance meetings. A recurring meeting must have a Meeting Workspace of its own. Therefore, if you pass true to the GetWorkspacesToLinkTo method, you get a collection that includes only Meeting Workspace sites that do not currently host a meeting.

Before calling the GetWorkspacesToLinkTo method, you must first get an instance of the SPMeeting class by calling the GetMeetingInformation(SPWeb) method, passing a SPWeb object that represents the Web site that is the parent of subsites that are Meeting Workspace sites. The following example retrieves Meeting Workspace sites immediately below the root Web site for a site collection.

' Get a meeting object.
Dim meeting As SPMeeting = SPMeeting.GetMeetingInformation(rootWeb)

' Get a collection of Meeting Workspace sites for non-recurring meetings.
Dim workspaces As SPWebCollection = meeting.GetWorkspacesToLinkTo(False)
// Get a meeting object.
SPMeeting meeting = SPMeeting.GetMeetingInformation(rootWeb);

// Get a collection of Meeting Workspace sites for non-recurring meetings.
PWebCollection workspaces = meeting.GetWorkspacesToLinkTo(false);

Examples

The following example is a console application that gets a collection of Meeting Workspace sites for single-instance meetings. The code then gets the Attendee list for each workspace and prints the e-mail address and status of each attendee on the list.

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

Module ConsoleApp
   Sub Main()
      Using siteCollection As SPSite = New SPSite("https://localhost")
         Using rootWeb As SPWeb = siteCollection.RootWeb

            ' Get a meeting object.
            Dim mtg As SPMeeting = SPMeeting.GetMeetingInformation(rootWeb)

            ' Get a collection of Meeting Workspace sites for non-recurring meetings.
            Dim webs As SPWebCollection = mtg.GetWorkspacesToLinkTo(False)
            Dim web As SPWeb
            For Each web In webs

               ' Print the URL for the workspace.
               Console.WriteLine(web.Url)
               Try
                  ' Get the attendee list.
                  Dim attendees As SPList = web.Lists("Attendees")

                  ' Print the email address and status of each attendee.
                  Dim item As SPListItem
                  For Each item In attendees.Items
                     Console.WriteLine("Attendee: {0} | Status: {1}", _
                                       item.Title, item(SPBuiltInFieldId.AttendeeStatus))
                  Next
               Catch ex As ArgumentException
                  Console.WriteLine("The workspace does not have an Attendees list.")
               End Try

               Console.WriteLine()
               web.Dispose()
            Next
         End Using
      End Using
      Console.Write(vbCrLf + "Press ENTER to continue...")
      Console.ReadLine()
   End Sub
End Module
using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Meetings;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         using (SPSite siteCollection = new SPSite("https://localhost"))
         {
            using (SPWeb rootWeb = siteCollection.RootWeb)
            {
               // Get a meeting object.
               SPMeeting mtg = SPMeeting.GetMeetingInformation(rootWeb);

               // Get a collection of Meeting Workspace sites for non-recurring meetings.
               SPWebCollection webs = mtg.GetWorkspacesToLinkTo(false);
               foreach (SPWeb web in webs)
               {
                  // Print the URL for the workspace.
                  Console.WriteLine(web.Url);

                  try
                  { 
                     // Get the attendee list.
                     SPList attendees = web.Lists["Attendees"];
                     
                     // Print the email address and status of each attendee.
                     foreach (SPListItem item in attendees.Items)
                     {
                        Console.WriteLine("Attendee: {0} | Status: {1}", 
                                          item.Title, item[SPBuiltInFieldId.AttendeeStatus]);
                     }
                  }
                  catch (ArgumentException ex)
                  {
                     Console.WriteLine("The workspace does not have an Attendees list.");
                  }

                  Console.WriteLine();
                  web.Dispose();
               }
            }
         }
         Console.Write("\nPress ENTER to continue...");
         Console.ReadLine();
      }
   }
}

See Also

Reference

SPMeeting Class

SPMeeting Members

Microsoft.SharePoint.Meetings Namespace

LinkWithEvent