0
votes

I'm trying to put some order in my mailbox, I've set several macros to order email based on very specific preferences, that outlook rules can't manage (I think ...)

I end up with several folder, with several conversations inside of it. I just want to move folders with old conversations to another folder.

I'm trying to move a folder with all his content, including subfolders, and emails ...

I can code a recursive function for this, but I just want to be sure there's no other coding options.

Folder.Move(ColdCaseFolder)

Won't work ...

I'm used to VBA macroing, but I couldn't find any article on MSDN about moving folders, only items ...

1

1 Answers

1
votes

The Folder class from the Outlook object model doesn't provide the Move method. You need to use the MoveTo method instead. For example:

Sub MoveFolder() 
  Dim myNameSpace As Outlook.NameSpace 
  Dim myFolder As Outlook.Folder 
  Dim myNewFolder As Outlook.Folder 

  Set myNameSpace = Application.GetNamespace("MAPI") 
  Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts) 
  Set myNewFolder = myFolder.Folders.Add("My Test Contacts") 
  myNewFolder.MoveTo myNameSpace.GetDefaultFolder(olFolderInbox) 
End Sub