SetAlwaysMoveToFolder 方法(Outlook)Conversation.SetAlwaysMoveToFolder method (Outlook)

设置一个 Folder 对象,该对象指示将会话中到达的所有现有项目和新项目始终移至其中的文件夹。Sets a Folder object that indicates the folder to which all existing conversation items and new items that arrive in the conversation are always moved.

语法Syntax

expressionexpression. SetAlwaysMoveToFolder( _MoveToFolder_ , _Store_ )SetAlwaysMoveToFolder( _MoveToFolder_ , _Store_ )

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

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
MoveToFolderMoveToFolder 必需Required 文件夹Folder 指定将会话中到达的所有现有项目和新项目始终移至其中的文件夹。Specifies the folder to which all existing items and new items that arrive in the conversation are always moved.
存储区Store 必需Required StoreStore 指定相应存储区,该存储区包含要将会话项目移至其中的文件夹。Specifies the store that contains the folder to which items of the conversation are moved.

备注Remarks

SetAlwaysMoveToFolder 方法对 Store 参数指定的传递存储区中的会话项目执行操作。The SetAlwaysMoveToFolder method operates on conversation items in the delivery store specified by the Store parameter. 如果 Store 参数代表诸如存档 .pst 存储区之类的非传递存储区,则将对默认传递存储区中的会话项目执行移动操作。If the Store parameter represents a non-delivery store such as an archive .pst store, the move action will apply to conversation items in the default delivery store.

如果_MoveToFolder_参数指定的文件夹不存在、已被移动或为只读,则 Outlook 将引发错误。If the MoveToFolder parameter specifies an invalid folder that does not exist, has been moved, or is read-only, Outlook will raise an error.

若要停止对存储中的会话项目的 "始终移动到文件夹" 操作,请调用**StopAlwaysMoveToFolder** 方法。To stop the always-move-to-folder action for conversations items in a store, call the StopAlwaysMoveToFolder method.

备注

[!注释] 将已删除邮件文件夹设置为 MoveToFolder SetAlwaysMoveToFolder 中的参数不等效于调用 SetAlwaysDelete 上的同一个存储和对话。Setting the Deleted Items folder as the MoveToFolder parameter in SetAlwaysMoveToFolder is not equivalent to calling SetAlwaysDelete on the same store and conversation. 将 _MoveToFolder_参数设置为已删除邮件文件夹结果在 GetAlwaysDelete 方法中返回值 olDoNotDeleteSetting the MoveToFolder parameter to the Deleted Items folder results in the GetAlwaysDelete method returning the value olDoNotDelete.

当您调用SetAlwaysMoveToFolder时,会发生Folder对象的**BeforeItemMove** 事件。The BeforeItemMove event of the Folder object occurs when you call SetAlwaysMoveToFolder.

示例Example

下面的 Visual Basic for Applications (VBA) 的示例演示如何设置现有对话项目和新项目到达特定的邮件项的对话,都始终移动到的文件夹。The following Visual Basic for Applications (VBA) example shows how to set the folder to which existing conversation items and new items that arrive in the conversation of a specific mail item are always moved. 该代码示例中, DemoSetAlwaysMoveToFolder,选择第一封邮件显示在阅读窗格中的特定邮件项,并命名为对话将项目移动到该文件夹的"1-参考"下的收件箱文件夹的文件夹。The code example, DemoSetAlwaysMoveToFolder, chooses the first mail item displayed in the Reading Pane as the specific mail item, and the folder named "1-Reference" under the Inbox folder as the folder to move the conversation items to. DemoSetAlwaysMoveToFolder验证会话启用所选的邮件项的存储区中,获得该邮件项的对话对象,如果对话存在,并使用 SetAlwaysMoveToFolder 总是移动所有现有对话项目和到达至指定的文件夹在此对话中的新项目。DemoSetAlwaysMoveToFolder verifies that conversations are enabled in the store for the selected mail item, obtains the conversation object for that mail item if a conversation exists, and uses SetAlwaysMoveToFolder to always move all existing conversation items and new items that arrive in the conversation to the specified folder.

Sub DemoSetAlwaysMoveToFolder() 
 Dim oMail As Outlook.MailItem 
 Dim oConv As Outlook.Conversation 
 Dim oStore As Outlook.Store 
 Dim oFolder As Outlook.Folder 
 
 ' Obtain a reference to the folder where conversation items will be moved. 
 Set oFolder = _ 
 Application.Session.GetDefaultFolder(olFolderInbox).Folders("1-Reference") 
 ' Get the Item displayed in the Reading Pane. 
 Set oMail = ActiveExplorer.Selection(1) 
 Set oStore = oFolder.Store 
 If oStore.IsConversationEnabled Then 
 Set oConv = oMail.GetConversation 
 If Not (oConv Is Nothing) Then 
 oConv.SetAlwaysMoveToFolder oFolder, oStore 
 End If 
 End If 
End Sub

另请参阅See also

会话对象Conversation 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.