SPMeeting.GetItemMeetingInstanceId Method
Returns the identifier (ID) for the meeting instance that is associated with an item in a list in a Meeting Workspace.
Namespace: Microsoft.SharePoint.Meetings
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Shared Function GetItemMeetingInstanceId ( _
item As SPListItem _
) As String
'Usage
Dim item As SPListItem
Dim returnValue As String
returnValue = SPMeeting.GetItemMeetingInstanceId(item)
public static string GetItemMeetingInstanceId(
SPListItem item
)
Parameters
item
Type: Microsoft.SharePoint.SPListItemAn item in a list on a Meeting Workspace site.
Return Value
Type: System.String
Returns a string that representsthe instance ID for the meeting instance associated with the specified list item.
Remarks
If no meeting instance is associated with an item, the method returns an empty string. The method also returns an empty string if it is unable to determine which meeting instance is associated with the item.
Examples
The following example is a console application that iterates through all Meeting Workspace sites below a Web site, finds the Agenda list in each workspace, and prints the name of each agenda item and the meeting instance that it is associated with.
Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Meetings
Module ConsoleApp
Sub Main()
Using site As SPSite = New SPSite("https://localhost")
Using web As SPWeb = site.RootWeb
' Get a collection of single-instance Meeting Workspace sites.
Dim mwWebs As SPWebCollection = _
SPMeeting.GetMeetingInformation(web).GetWorkspacesToLinkTo(False)
For Each workspace As SPWeb In mwWebs
Console.WriteLine(vbCrLf + "Agenda items for {0}:", workspace.Title)
' Get the Agenda list in each workspace.
For Each list As SPList In workspace.Lists
If list.BaseTemplate = CType(MeetingListTemplateType.MeetingAgenda, SPListTemplateType) Then
' Get a collection of list items for all meeting instances.
Dim query As SPQuery = New SPQuery()
query.MeetingInstanceId = CType(SPMeeting.SpecialInstance.AllWithSeries, Integer)
Dim items As SPListItemCollection = list.GetItems(query)
If items.Count = 0 Then
Console.WriteLine("No agenda items.")
End If
' Print the instance ID for each item.
For Each item As SPListItem In items
Console.Write("Item: {0, -15}", item.Name)
Dim instanceId As String = SPMeeting.GetItemMeetingInstanceId(item)
If String.Empty = instanceId Then
instanceId = Convert.ToString(item(SPBuiltInFieldId.InstanceID))
End If
Console.WriteLine("InstanceID: {0}", instanceId)
Next
Exit For
End If
Next list
' Clean up
workspace.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 site = new SPSite("https://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
// Get a collection of single-instance Meeting Workspace sites.
SPWebCollection mwWebs =
SPMeeting.GetMeetingInformation(web).GetWorkspacesToLinkTo(false);
foreach (SPWeb workspace in mwWebs)
{
Console.WriteLine("\nAgenda items for {0}:", workspace.Title);
// Get the Agenda list in each workspace.
foreach (SPList list in workspace.Lists)
{
if (list.BaseTemplate == (SPListTemplateType)MeetingListTemplateType.MeetingAgenda)
{
// Get a collection of list items for all meeting instances.
SPQuery query = new SPQuery();
query.MeetingInstanceId = (int)SPMeeting.SpecialInstance.AllWithSeries;
SPListItemCollection items = list.GetItems(query);
if (items.Count == 0)
{
Console.WriteLine("No agenda items.");
}
// Print the instance ID for each item.
foreach (SPListItem item in items)
{
Console.Write("Item: {0, -15}", item.Name);
string instanceId = SPMeeting.GetItemMeetingInstanceId(item);
if (string.Empty == instanceId)
{
instanceId = Convert.ToString(item[SPBuiltInFieldId.InstanceID]);
}
Console.WriteLine("InstanceID: {0}", instanceId);
}
break;
}
}
// Clean up.
workspace.Dispose();
}
}
}
Console.Write("\nPress ENTER to continue...");
Console.ReadLine();
}
}
}