cancel
Showing results for 
Search instead for 
Did you mean: 

Moving Outlook Email into Cabinet Folder

TomMason
Level 4
Hi All,   I'm having difficulty moving an Email from either the Inbox or a Sub-Folder within the Inbox into a Cabinet folder within Outlook. I am using the MS Outlook VBO (Uncertified) Object but having no joy whatsoever in any of the Pages included. It will work if the Cabinet is a subfolder of the Inbox but not if it is standalone.   Even when I move the Email into an Inbox subfolder and get the new ID, its not working.... I'm getting the following message: "Internal : Could not execute code stage because exception thrown by code stage: The attempted operation failed.  An object could not be found." Any ideas? Cheers Tom    
3 REPLIES 3

AmiBarrett
Level 12
When the Outlook VBO is searching for subfolders, it's first defining a root folder number - In this case, 6 for Inbox (or 5 for Sent Items). You can find a list of all of the default folder numbers here: https://msdn.microsoft.com/en-us/office/ff861868(v=office.12) It's likely that when the cabinet is standalone, it has its own folder number. You might also be able to reference the folder by name, but you'll want to clone and modify the ""Move Email to Inbox Sub Folder"" page to do it. Here's where it defines the default inbox folder, only for the sake of finding subfolders within it. Dim folder = _nameSpace.GetDefaultFolder(Outlook_Folder_ID) You can probably remove the If/Else and the loop, then change that line to read Dim folder = objMailbox.Folders(""Cab_Folder_Name_Here"")

AmiBarrett
Level 12

Sorry, correction to that last line. Leave the original Dim folder in there, then add this beneath it: 

Dim strFolderName = folder.Parent
Dim objMailbox = objNamespace.Folders(strFolderName)
Dim cabFolder = objMailbox.Folders(""Cab_Folder_Name_Here"") 


Then at the bottom, change the last line to:

New_Entry_ID = item.Move(cabFolder).EntryID

TomMason
Level 4
Thanks Ami.... yeah tried looking for the ID number but got nowhere.... I'll have a go at your suggestion.... many thanks!