How to: Customize Meeting Workspaces by Using the SharePoint Foundation Object Model

Last modified: January 17, 2010

Applies to: SharePoint Foundation 2010

The following code examples show how to use the Microsoft SharePoint Foundation object model to work with Meeting Workspace sites.

To identify existing Meeting Workspace sites

  • The following code example prints the names of the Meeting Workspace sites that exist on the top-level site on the server.

    Dim targetSite As New SPSite("http://server_name")
    Dim rootWeb As SPWeb = targetSite.OpenWeb("/")
    Dim spRootWebChildren As SPWebCollection = rootWeb.Webs
    For i As Integer = 0 To spRootWebChildren.Count - 1
        If spRootWebChildren(i).WebTemplateId = CInt(Fix(SPWebTemplate.WebTemplate.Meetings)) Then
            Console.WriteLine(spRootWebChildren(i).Name.ToString())
        End If
    Next i
    

To delete existing Meeting Workspace sites

  • The following code example deletes the Meeting Workspace site with the name "testmws" from the top-level site on the server.

    Dim targetSite As New SPSite("http:// server_name")
    Dim rootWeb As SPWeb = targetSite.OpenWeb("/")
    Dim spRootWebChildren As SPWebCollection = rootWeb.Webs
    For i As Integer = 0 To spRootWebChildren.Count - 1
        If spRootWebChildren(i).WebTemplateId = CInt(Fix(SPWebTemplate.WebTemplate.Meetings)) Then
           If spRootWebChildren(i).Name="testmws" Then
               spRootWebChildren.Delete("testmws")
           End If
        End If
    Next i
    
Show: