Conversation.StopAlwaysDelete Method (Outlook)
Published: July 16, 2012
Stops the action of always moving conversation items in the specified store to the Deleted Items folder in that store.
If the always-delete action has not been turned on, StopAlwaysDelete does not carry out any action.
If the always-delete action has been turned on (by calling the SetAlwaysDelete method, StopAlwaysDelete moves existing conversation items in the Deleted Items folder to the Inbox.
After calling the StopAlwaysDelete method for a conversation in a store, calling the GetAlwaysDelete method on that conversation and store returns the constant olDoNotDelete.
If the store specified by the Store parameter represents a non-delivery store such as an archive .pst store, the stop-always-delete action is applied to conversation items in the default delivery store.
Calling this method on a conversation that is already in the Deleted Items folder in the specified store returns an error.
The following Visual Basic for Applications (VBA) example shows how to stop the always-delete action for the conversation of a specific mail item. The code example, DemoStopAlwaysDelete, chooses the first mail item displayed in the Reading Pane as the specific mail item. DemoStopAlwaysDelete verifies that conversations are enabled on the store for the mail item, obtains the conversation that involves that mail item if a conversation exists, and uses SetAlwaysDelete to stop the always-delete action for that conversation on that store.
Sub DemoStopAlwaysDelete() Dim oMail As Outlook.MailItem Dim oConv As Outlook.Conversation Dim oStore As Outlook.Store ' Get the item displayed in the Reading Pane. Set oMail = ActiveExplorer.Selection(1) Set oStore = oMail.Parent.Store If oStore.IsConversationEnabled Then Set oConv = oMail.GetConversation If Not (oConv Is Nothing) Then oConv.StopAlwaysDelete oStore End If End If End Sub