如何:使用会议 Web 服务自定义会议工作区
上次修改时间: 2010年7月7日
适用范围: SharePoint Foundation 2010
Meetings Web 服务可帮助您创建和管理会议工作区网站。本主题介绍如何使用 Web 服务来执行以下任务:
标识现有会议工作区网站。
创建新的会议工作区网站并添加会议。
删除会议工作区网站。
更新会议工作区网站上的会议信息。
过程
在开始之前,请使用 Microsoft Visual Studio 创建一个 Windows 窗体应用程序。有关设置对 Microsoft SharePoint Foundation Web 服务的 Web 引用的信息,请参阅 Web 服务指南。
标识现有会议工作区网站
下面的代码示例列出了服务器上存在的会议工作区网站。
备注
该示例假定 ServerURLTextBox 是一个已添加到项目中的表单上的界面元素。
Dim ws As New mywss001.Meetings() Dim myCache As New System.Net.CredentialCache() Private Sub ListMWS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListMWS.Click ws.Credentials = myCache.DefaultCredentials() ws.Url = ServerURLTextBox.Text If (ws.Url.EndsWith("/")) Then ws.Url = ws.Url.Remove(ws.Url.Length - 1, 1) End If ws.Url = ws.Url + "/_vti_bin/meetings.asmx" Dim GetMeetingWorkspacesResponse As System.Xml.XmlNode If (ws.Url <> "") Then GetMeetingWorkspacesResponse = ws.GetMeetingWorkspaces(True) End If Dim OuterXml As String OuterXml = GetMeetingWorkspacesResponse.OuterXml() MsgBox("OuterXml") End Sub
mywss001.Meetings ws = new mywss001.Meetings(); System.Net.CredentialCache myCache = new System.Net.CredentialCache(); private void ListMWS_Click(System.Object sender, System.EventArgs e) { ws.Credentials = myCache.DefaultCredentials(); ws.Url = ServerURLTextBox.Text; if ((ws.Url.EndsWith("/"))) { ws.Url = ws.Url.Remove(ws.Url.Length - 1, 1); } ws.Url = ws.Url + "/_vti_bin/meetings.asmx"; System.Xml.XmlNode GetMeetingWorkspacesResponse = default(System.Xml.XmlNode); if ((!string.IsNullOrEmpty(ws.Url))) { GetMeetingWorkspacesResponse = ws.GetMeetingWorkspaces(true); } string OuterXml = null; OuterXml = GetMeetingWorkspacesResponse.OuterXml(); Interaction.MsgBox("OuterXml"); }
创建新的会议工作区网站并向其添加会议
下面的代码示例创建一个会议工作区网站并向其添加会议。
备注
该示例假定 ServerURLTextBox、MeetingSubjectTextBox、MeetingLocationTextBox、DTSTARTTextBox、DTENDTextBox 和 CreateWorkspaceButton 是已添加到项目中的表单上的所有界面元素。
Dim ws As New mywss001.Meetings() Dim tz As New mywss001.TimeZoneInf() Dim myCache As New System.Net.CredentialCache() Dim UID As Integer Dim Sequence As UInt32 Private Sub CreateWorkspaceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateWorkspaceButton.Click ws.Credentials = myCache.DefaultCredentials() ws.Url = ServerURLTextBox.Text If (ws.Url.EndsWith("/")) Then ws.Url = ws.Url.Remove(ws.Url.Length - 1, 1) End If ws.Url = ws.Url + "/_vti_bin/meetings.asmx" Dim CreateWorkspaceResponse As System.Xml.XmlNode If (ws.Url <> "") Then CreateWorkspaceResponse = ws.CreateWorkspace(MeetingSubjectTextBox.Text, "MPS#0", System.UInt32.Parse("1033"), tz) End If Dim OuterXml As String OuterXml = CreateWorkspaceResponse.OuterXml() Dim MWSURL As String Dim Start As Integer Dim Finish As Integer Start = OuterXml.IndexOf("""") Finish = OuterXml.IndexOf("""", Start + 1) MWSURL = OuterXml.Substring(Start + 1, Finish - Start - 1) Dim MyRand As New System.Random() UID = MyRand.Next(100, 10000) Sequence.ToString("0") ws.Url = MWSURL + "/_vti_bin/meetings.asmx" ws.AddMeeting("", UID.ToString, Sequence, "2003-03-27T15:00:00-08:00", MeetingSubjectTextBox.Text, MeetingLocationTextBox.Text, DTSTARTTextBox.Text, DTENDTextBox.Text, False) MWSURLLink.Text = MWSURL End Sub
mywss001.Meetings ws = new mywss001.Meetings(); mywss001.TimeZoneInf tz = new mywss001.TimeZoneInf(); System.Net.CredentialCache myCache = new System.Net.CredentialCache(); int UID; UInt32 Sequence; private void CreateWorkspaceButton_Click(System.Object sender, System.EventArgs e) { ws.Credentials = myCache.DefaultCredentials(); ws.Url = ServerURLTextBox.Text; if ((ws.Url.EndsWith("/"))) { ws.Url = ws.Url.Remove(ws.Url.Length - 1, 1); } ws.Url = ws.Url + "/_vti_bin/meetings.asmx"; System.Xml.XmlNode CreateWorkspaceResponse = default(System.Xml.XmlNode); if ((!string.IsNullOrEmpty(ws.Url))) { CreateWorkspaceResponse = ws.CreateWorkspace(MeetingSubjectTextBox.Text, "MPS#0", System.UInt32.Parse("1033"), tz); } string OuterXml = null; OuterXml = CreateWorkspaceResponse.OuterXml(); string MWSURL = null; int Start = 0; int Finish = 0; Start = OuterXml.IndexOf("\""); Finish = OuterXml.IndexOf("\"", Start + 1); MWSURL = OuterXml.Substring(Start + 1, Finish - Start - 1); System.Random MyRand = new System.Random(); UID = MyRand.Next(100, 10000); Sequence.ToString("0"); ws.Url = MWSURL + "/_vti_bin/meetings.asmx"; ws.AddMeeting("", UID.ToString, Sequence, "2003-03-27T15:00:00-08:00", MeetingSubjectTextBox.Text, MeetingLocationTextBox.Text, DTSTARTTextBox.Text, DTENDTextBox.Text, false); MWSURLLink.Text = MWSURL; }
删除会议工作区网站
下面的代码示例删除指定的会议工作区网站。
备注
该示例假定"MWSURLLink"包含会议工作区网站的 URL。
Private Sub DeleteWorkspaceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteWorkspaceButton.Click ws.Credentials = myCache.DefaultCredentials() ws.Url = MWSURLLink.Text + "/_vti_bin/meetings.asmx" ws.DeleteWorkspace() End Sub
private void DeleteWorkspaceButton_Click(System.Object sender, System.EventArgs e) { ws.Credentials = myCache.DefaultCredentials(); ws.Url = MWSURLLink.Text + "/_vti_bin/meetings.asmx"; ws.DeleteWorkspace(); }
更新会议工作区网站上的会议信息
下面的代码示例更新存在于会议工作区网站上的会议。
备注
该示例假定 MWSURLLink、MeetingSubjectTextBox、MeetingLocationTextBox、DTSTARTTextBox、DTENDTextBox 和 CreateWorkspaceButton 是已添加到项目中的表单上的所有界面元素。
Private Sub UpdateMeetingButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateMeetingButton.Click ws.Credentials = myCache.DefaultCredentials() ws.Url = MWSURLLink.Text + "/_vti_bin/meetings.asmx" Sequence.ToString("0") ws.UpdateMeeting(UID, Sequence, "2003-03-27T15:00:00-08:00", MeetingSubjectTextBox.Text, MeetingLocationTextBox.Text, DTSTARTTextBox.Text, DTENDTextBox.Text, False) End Sub
private void UpdateMeetingButton_Click(System.Object sender, System.EventArgs e) { ws.Credentials = myCache.DefaultCredentials(); ws.Url = MWSURLLink.Text + "/_vti_bin/meetings.asmx"; Sequence.ToString("0"); ws.UpdateMeeting(UID, Sequence, "2003-03-27T15:00:00-08:00", MeetingSubjectTextBox.Text, MeetingLocationTextBox.Text, DTSTARTTextBox.Text, DTENDTextBox.Text, false); }