命名空间 RemoveStore 方法 (Outlook)NameSpace.RemoveStore method (Outlook)

从当前的 MAPI 配置文件或会话中删除个人文件夹文件 (.pst)。Removes a Personal Folders file (.pst) from the current MAPI profile or session.

语法Syntax

expressionexpression. RemoveStore( _Folder_ )

_表达式_一个代表NameSpace对象的变量。expression A variable that represents a NameSpace object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
FolderFolder 必需Required FolderFolder 要从列表中删除的个人文件夹文件 (.pst)。The Personal Folders file (.pst) to be deleted from the list.

说明Remarks

此方法仅从 Microsoft Outlook 用户界面删除存储。This method removes a store only from the Microsoft Outlook user interface. 不能使用 Outlook 对象模型从服务器上的主邮箱或从用户硬盘删除存储。You cannot remove a store from the main mailbox on the server or from a user's hard disk using the Outlook object model.

示例Example

下面的 Microsoft Visual Basic for Applications (VBA) 示例将从文件夹列表中删除名为“Personal Folders”的文件夹。The following Microsoft Visual Basic for Applications (VBA) examples removes a folder called Personal Folders from the list of folders.

Sub RemovePST() 
 
 Dim objName As Outlook.NameSpace 
 
 Dim objFolder As Outlook.Folder 
 
 
 
 Set objName = Application.GetNamespace("MAPI") 
 
 Set objFolder = objName.Folders.Item("Personal Folders") 
 
 'Prompt the user for confirmation 
 
 Dim strPrompt As String 
 
 strPrompt = "Are you sure you want to remove the Personal Folders file?" 
 
 If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then 
 
 objName.RemoveStore objFolder 
 
 End If 
 
End Sub

另请参阅See also

命名空间对象NameSpace Object

支持和反馈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.