Manage WSS 3.0 meetings workspaces and meetings via Web Services

March 27th, 2009 by ganton | Print

WSS 3.0 platform provides a bunch of Web Services that can be used to manage different WSS objects. They expose via Web Services interfaces part of the functionality that is available for you via WSS 3.0 object model. The full list of available Web Services you can find here.

In this post I’d like to share with you my experience of using Meetings Web Service in order to create, remove, update a meeting workspace and add a new meeting to the created workspace.

Before starting you should create a new project in Visual Studio and to add a Web Reference to the Meetings.asmx WSS Web Service. For this sample we will use a WPF Application project. Below is the main form of the application that we will use in order to provide an interface of managing meeting workspaces to the end-user. It allows the end-user to specify WSS web site URL, meeting workspace title, choose a template, etc.

wss_meetings_main_form

Now we are ready to write a code that will create a new meeting workspace. To do so, we will use CreateWorkspace method of the Web Service. This method will create a new meeting workspace subsite on the specified server running WSS. The method accepts four parameters: workspace’s title, the template name that will be used when the workspace is created, the locale identifier and an instance of TimeZoneInf class. You can go to MSDN documentation and find what templates are supported for meeting workspace and use one of them. But in our solution I choose to retrieve all available workspace templates from the Web Service and to give to the end-user an option to choose one of them. To do so, we will use GetMeetingsInformation method of the service. It accepts two parameters: request flags and locale ID. Using request flags we can control what of the information available for the workspace we’d like to retrieve. In this sample we will use an unsigned integer 4. It will require from the service to provide to us available templates information. Below is the code that we can use in order to get all available templates and put them into a hashtable and a combobox.

   1: proxy.Url = ComposeUrl();            
   2: XmlNode information = proxy.GetMeetingsInformation(UInt32.Parse("4"), UInt32.Parse("1033"));
   3: templatesList.Clear();
   4: templateTypeComboBox.Items.Clear();
   5:  
   6: foreach (XmlNode node in information.ChildNodes[0].ChildNodes)
   7: {
   8:     templateTypeComboBox.Items.Add(node.Attributes["Title"].Value);
   9:  
  10:     templatesList.Add(node.Attributes["Title"].Value,
  11:         node.Attributes["Name"].Value);
  12: }
  13: if (templateTypeComboBox.Items.Count > 0)
  14: {
  15:     templateTypeComboBox.SelectedIndex = 0;
  16: }

Assume that we have defined and initialized a Meetings Web Service instance named proxy somewhere on the class level and we can use it everywhere in the class code. ComposeUrl method will return a full Url of the meetings.asmx service depending of what WSS web site Url the end-user has chosen. The important moment here is the call of the GetMeetingsInformation method with a request flag 4. Below is the XML response that the method returns.

   1: <?xml version="1.0" encoding="utf-16"?>
   2: <MeetingsInformation xmlns="http://schemas.microsoft.com/sharepoint/soap/meetings/">
   3:   <ListTemplates>
   4:     <Template
   5:       Name="MPS#0"
   6:       Title="Basic Meeting Workspace"
   7:       Id="2"
   8:       Description="A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda, meeting attendees, and documents."
   9:       ImageUrl="http://gocheva-vm1/_layouts/images/mwsprev.png" />
  10:     <Template
  11:       Name="MPS#1"
  12:       Title="Blank Meeting Workspace"
  13:       Id="2"
  14:       Description="A blank meeting site for you to customize based on your requirements."
  15:       ImageUrl="http://gocheva-vm1/_layouts/images/blankmwsprev.png" />
  16:     <Template
  17:       Name="MPS#2"
  18:       Title="Decision Meeting Workspace"
  19:       Id="2"
  20:       Description="A site for meetings that track status or make decisions. It provides lists for creating tasks, storing documents, and recording decisions."
  21:       ImageUrl="http://gocheva-vm1/_layouts/images/decisionmwsprev.png" />
  22:     <Template
  23:       Name="MPS#3"
  24:       Title="Social Meeting Workspace"
  25:       Id="2"
  26:       Description="A site to plan social occasions. It provides lists for tracking attendees, providing directions, and storing pictures of the event."
  27:       ImageUrl="http://gocheva-vm1/_layouts/images/socialmwsprev.png" />
  28:     <Template
  29:       Name="MPS#4"
  30:       Title="Multipage Meeting Workspace"
  31:       Id="2"
  32:       Description="A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda and meeting attendees in addition to two blank pages for you to customize based on your requirements."
  33:       ImageUrl="http://gocheva-vm1/_layouts/images/multipagemwsprev.png" />
  34:   </ListTemplates>
  35: </MeetingsInformation>

Note that we have several templates returned with additional information in <Template /> tag and its attributes. We use part of the information in order to fill in our combobox and hashtable.

Now we are ready to create a new meeting workspace based on some of the templates. Below is the code needed.

   1: string template = templatesList[templateTypeComboBox.SelectedValue as string];
   2: Meetings.TimeZoneInf tzi = new WSSClientWpfApp.Meetings.TimeZoneInf();
   3: XmlNode resultNode = proxy.CreateWorkspace(meetingWorkspaceNameTextBox.Text.Replace(‘ ‘, ‘_’), template, (uint)1033, tzi);
   4: XmlNode urlNode = resultNode.SelectSingleNode("@Url");
   5: if (urlNode == null)
   6: {
   7:     MessageBox.Show("The Workspace has not been created.");
   8:     return XmlFormatter.Format(resultNode.OuterXml);                        
   9: }
  10: proxy.Url = urlNode.Value + meetingsService;
  11: proxy.SetWorkspaceTitle(meetingWorkspaceNameTextBox.Text);

Here we have two important moments: the call of the CreateWorkspace at line 3 and the call of SetWorkspaceTitle at line 11. We use CreateWorkspace with provided by the user parameters in order to create the new meeting workspace. In addition, we replace all spaces with underscores in the title because the title will be used by the method to create the URL and we do not want to have spaces in the URL. It also will use provided string as a title of the workspace. That’s why we call SetWorkspaceTitle in order to change the title of the workspace in a user friendly way. Note that before calling the method we preset the proxy Url property. We do this because this method should be called to the web service relative to the meeting workspace web subsite location. If we choose a workspace title "Simple Meeting" we will call the method against a service at http://<web site>/Simple_Meeting/_vti_bin/meetings.asmx. Note that all WSS 3.0 Web services are located at IIS virtual directory named _vti_bin.

Now we can remove our meeting workspace. To do so we can use DeleteWorkspace. It accepts no parameters and should be executed against a meetings web service relative to the meeting workspace web site that should be deleted. In you case it should be http://<web site>/<meeting_workspace_web_site>/_vti_bin/meetings.asmx. We also like to give an option to the end-user to select which meeting workspace to delete. To do so we will use GetMeetingWorkspaces method of the service. This method will return to us all available meeting workspaces. The code is below.

   1: XmlNode workspaces = proxy.GetMeetingWorkspaces(false);
   2:  
   3: foreach (XmlNode node in workspaces.ChildNodes)
   4: {
   5:     workspacesComboBox.Items.Add(
   6:         node.Attributes["Title"].Value);
   7:     wokspacesList.Add(node.Attributes["Title"].Value, node.Attributes["Url"].Value);
   8: }

For the selection we will use a form like below.

wss_meetings_delete_workspace_form

The code that deletes selected workspace is below.

   1: proxy.Url = wokspacesList[workspacesComboBox.SelectedItem as string] + "/_vti_bin/meetings.asmx";
   2: proxy.DeleteWorkspace();

That is all for today. The next time I’ll explain how to manage new meetings in a meeting workspace. In addition, I’ll provide the full application code as sample.

One Response to “Manage WSS 3.0 meetings workspaces and meetings via Web Services”

  1. John Taylor Says:

    I found your blog on Google. I’ve bookmarked it and will watch out for your next blog post.

Leave a Reply