如何以编程方式获得Exchange中邮箱的大小

2008-02-23 06:12:08来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

本页
概要概要
更多信息更多信息
扩展 MAPI 方法扩展 MAPI 方法
CDO 1.21 方法CDO 1.21 方法
ActiveX 数据对象 (ADO) 方法ActiveX 数据对象 (ADO) 方法
WebDAV 方法WebDAV 方法
这篇文章中的信息适用于:这篇文章中的信息适用于:

概要

本文描述如何使用 Microsoft Visual C、Microsoft Visual C 、Microsoft Visual Basic 和 Microsoft Visual Basic Scripting Edition (VBScript) 在运行 Microsoft Exchange 的服务器上以编程方式检索有关邮箱大小的信息。
中国网管联盟

更多信息

扩展 MAPI 方法

可用的编程语言:Visual C 和 Visual C
Exchange Server 版本:Exchange Server 5.5、Exchange 2000 和 Exchange 2003

扩展 MAPI 提供了 IExchangeManageStore 接口以从 Exchange 信息存储区获得管理信息。此接口提供了 GetMailboxTable 函数,该函数返回包含有关特定服务器上邮箱信息的 IMAPITable 接口。请注意此函数需要具备对运行 Exchange Server 的服务器的管理权限。

此表包含的列提供了有关每个邮箱大小的信息。PR_MESSAGE_SIZE 属性包含邮箱的大小(以字节为单位)。

有关其他信息,请访问下面的 Microsoft Developer Network (MSDN) 网站:
IExchangeManageStore::GetMailboxTable
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exchserv/html/intrface_24it.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exchserv/html/intrface_24it.asp)
有关其他信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章:
200160 (http://support.microsoft.com/kb/200160/) 如何使用 GetMailboxTable 循环完 Exchange 上的邮箱

CDO 1.21 方法

可用的编程语言:VBScript、Visual Basic、Visual C 和 Visual C
DL.bitsCN.com网管软件下载

Exchange Server 版本:Exchange Server 5.5、Exchange 2000 和 Exchange 2003

能够使用协作数据对象 (CDO) 1.21 通过 CDO InfoStore 对象,检查用户邮箱存储上的相同属性。在此方法中,应用程式必须先登录到邮箱,然后才能够检查此属性。这意味着应用程式必须能够访问服务器上的任何邮箱。此方法还需要生成服务器上邮箱的列表,并在代码中循环完这些邮箱。

下面的示例是个简单的 VBScript 代码示例,能够检查邮箱上的此属性。要使用此示例,请将下面的代码粘贴到一个新的文本文档,然后将此文档命名为 Mailboxsize.vbs:
'This script logs>有关此主题和检索邮箱大小的 Visual C   示例的其他信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章: 
291368 (http://support.microsoft.com/kb/291368/) 如何在 C 中使用 ADO 确定 Exchange 2000 Server 邮箱的大小

WebDAV 方法

语言:VBScript、Visual Basic 和 Visual C
Exchange Server 版本:Exchange 2000 和 Exchange 2003

也能够使用 WebDAV 方法(类似于 ADO 方法)。属性和算法是相同的,因为能够从邮箱的任何子文档夹添加 http://schemas.microsoft.com/mapi/proptag/x0e080003 的值。使用 WebDAV 代替 ADO 的一个好处是:代码无须在运行 Exchange 2000 或 Exchange 2003 的电脑上运行。
bitscn.com


要使用此示例,请将下面的代码粘贴到一个新的文本文档,然后将此文档命名为 Mailboxsize.vbs:
'This script logs1.0""?>"   sQuery = sQuery & "<g:searchrequest xmlns:g=""DAV:"">"   sQuery = sQuery & "<g:sql>SELECT ""http://schemas.microsoft.com/"   sQuery = sQuery & "mapi/proptag/x0e080003"", ""DAV:hassubs"" FROM SCOPE "   sQuery = sQuery & "('SHALLOW TRAVERSAL OF """ & sUrl & """') "   sQuery = sQuery & "WHERE ""DAV:isfolder"" = true"   sQuery = sQuery & "</g:sql>"   sQuery = sQuery & "</g:searchrequest>"   ' Set request headers.   oXMLHttp.setRequestHeader "Content-Type", "text/xml"   oXMLHttp.setRequestHeader "Translate", "f"   oXMLHttp.setRequestHeader "Depth", "0"   oXMLHttp.setRequestHeader "Content-Length", "" & Len(sQuery)   ' Send request.   oXMLHttp.send sQuery   If Err.Number <> 0 Then      WScript.Echo "Error Sending Query"      WScript.Echo Err.Number & ": " & Err.Description      Set oXMLHttp = Nothing   End If   ' Load XML.   Set oXMLDoc = oXMLHttp.responseXML   ' Get the XML nodes that contain the individual sizes.   Set oXMLSizeNodes = oXMLDoc.getElementsByTagName("d:x0e080003")   ' Get the XML nodes that contain the individual HREFs.   Set oXMLHREFNodes = oXMLDoc.getElementsByTagName("a:href")   ' Get the XML nodes that contain the individual HasSubs.   Set oXMLHasSubsNodes = oXMLDoc.getElementsByTagName("a:hassubs")   ' Loop through the nodes, and then add all of the sizes.   For i = 0 to oXMLSizeNodes.length - 1      WScript.Echo oXMLHREFNodes.Item(i).nodeTypedValue      WScript.Echo "Size: " & oXMLSizeNodes.Item(i).nodeTypedValue      iSum = iSum   oXMLSizeNodes.Item(i).nodeTypedValue      ' If the folder has subfolders, call your recursive function to      ' process subfolders.      If oXMLHasSubsNodes.Item(i).nodeTypedValue = True Then         RecurseFolder oXMLHREFNodes.Item(i).nodeTypedValue      End If   Next   ' Clean up.   Set oXMLSizeNodes = Nothing   Set oXMLDoc = Nothing   Set oXMLHttp = NothingEnd Sub				 
			   
			   

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇: Exchange Server 2003中的恢复存储组

下一篇: 卸载 Exchange 2003 的步骤