GetNamespace 方法 (Outlook)Application.GetNamespace method (Outlook)

返回指定类型的**命名空间** 对象。Returns a NameSpace object of the specified type.

语法Syntax

expressionexpression. GetNamespace( _Type_ )

expression:表示“Application”对象的变量。expression A variable that represents an Application object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
TypeType 必需Required StringString 要返回的命名空间的类型。The type of name space to return.

返回值Return value

一个代表指定命名空间的namespace对象。A NameSpace object that represents the specified namespace.

说明Remarks

唯一受支持的命名空间类型是"MAPI"。The only supported name space type is "MAPI". GetNameSpace方法在功能上等效于Session属性。The GetNameSpace method is functionally equivalent to the Session property.

示例Example

本 Visual Basic for Applications (VBA) 示例使用**CurrentFolder** 属性将显示的文件夹更改为用户的 "日历" 文件夹。This Visual Basic for Applications (VBA) example uses the CurrentFolder property to change the displayed folder to the user's Calendar folder.

Sub ChangeCurrentFolder() 
 
 Dim myNamespace As Outlook.NameSpace 
 
 
 
 Set myNamespace = Application.GetNamespace("MAPI") 
 
 Set Application.ActiveExplorer.CurrentFolder = _ 
 
 myNamespace.GetDefaultFolder(olFolderCalendar) 
 
End Sub

另请参阅See also

Application 对象Application Object

如何︰ 获取和登录到 Outlook 实例How to: Obtain and Log On to an Instance of Outlook

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.