Compartilhar via


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

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.

    SPSite targetSite = new SPSite("http://server_name");
    SPWeb rootWeb = targetSite.OpenWeb("/");
    SPWebCollection spRootWebChildren = rootWeb.Webs;
    for (int i =0; i<spRootWebChildren.Count; i++)
    {
        if(spRootWebChildren[i].WebTemplateId == (int)SPWebTemplate.WebTemplate.Meetings)
        {
            Console.WriteLine(spRootWebChildren[i].Name.ToString());
        }
     }
    
    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.

    SPSite targetSite = new SPSite("http://server_name");
    SPWeb rootWeb = targetSite.OpenWeb("/");
    SPWebCollection spRootWebChildren = rootWeb.Webs;
    for (int i =0; i<spRootWebChildren.Count;i++)
    {
        if(spRootWebChildren[i].WebTemplateId == (int) SPWebTemplate.WebTemplate.Meetings)
        {
            if(spRootWebChildren[i].Name=="testmws")
                spRootWebChildren.Delete("testmws");
        }
    }
    
    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
    

See Also

Reference

Microsoft.SharePoint.Meetings

Concepts

Namespaces in the SharePoint Foundation Object Model