Moving Email from Shared Inbox to nested subfolders

anjali

New Member
Hi ,

Am looking for a functionality : To move my current email from shared Inbox to the nested subfolder . Here based on region name I need to move email (from Inbox) to the respective RegionName folder(RegionName2) .

Hierarchy is

Inbox
|
Region
|
RegionName1
RegionName2
RegionName3

Any leads or help is much appreciated . Thank You .
 

Sachin_Kharmale

Active Member
Hello Anjali,

if you are working with the MS Outlook VBO then ,
You need to Design code stage to move mail from one folder to another sub folder.
1.Find your desired mail that you want to move.
2. Obtain Sub folder object.
3.use mailObject.Move(SubfolderObject) to move mail from one folder to another sub folder.

I hope it will help you.,
 

anjali

New Member
Does this mean for a hierarchy , I will have to move to subfolder and from there to another subfolder .
In the attached screenshot from my Inbox I need to move email to folder "Documents" . But with mailObject.Move(SubfolderObject) I can only move my mails from Inbox to BBH , not to Documents.
Based on business rules I need to move mails from Parent (Inbox) to various Sub-Subfolder (nested )
 

Attachments

  • Sub-folder.JPG
    12.7 KB · Views: 161

_aurelie_

New Member
Hello anjali,
Did you find an answer ? If not, maybe you could try "Subfolder A\Subfolder B\Subfolder C"

There is a description in the "MS Outlook Email VBO", action "Move Email to inbox sub folder" :
"Destination Folder : Any alphanumeric value valid. The Subfolder in the Inbox, eg. Subfolder A needs to be declared as "Subfolder A". A Nested Subfolder eg. Subfolder B in Subfolder A, needs to be declared as "Subfolder A\Subfolder B".

best regards,
aurelie
 

anjali

New Member
I tried using Subfolder A\Subfolder B , it does break the folder and get into Subfolder B , but while using item.Move (folder ) , it gives an error
 

Attachments

  • MoveEmail.JPG
    73.7 KB · Views: 108

Felix_90

New Member
Example:
Mailaddress of the shared Mailbox: shared.mail@box.de
Name of the Mailaccount: Shared Mail (sometimes this can also be the mail address)

Folderstructure:

Shared Mail (<-- Name of the Shared Mailbox)
->Inbox
->Deleted Items
->....
->Folder
----->First Folder
----->Second Folder
->Sent

---------------------------------------------------------------------

Dim app = CreateObject("Outlook.Application")
Dim _nameSpace = app.GetNameSpace("MAPI")
Dim Store_ID As String


Dim mailbox = _nameSpace



Dim vRecipient = _nameSpace.CreateRecipient(SharedMail)
vRecipient.Resolve
Dim folder = _nameSpace.GetSharedDefaultFolder(vRecipient, 6)
Store_ID = folder.StoreID
Dim item = _nameSpace.GetItemFromID(Entry_ID, Store_ID)



If Destination_Folder <> "" Then
For each name as string in Destination_Folder.Split("\")
mailbox = mailbox.Folders(name)
Next
End if



New_Entry_ID = item.Move(mailbox).EntryID

--------------------------------------------------------------------

Inputs are:
Entry_ID: ID from the mail which has to be moved
Destination_Folder: Shared Mail\Folder\First Folder
SharedMail: shared.mail@box.de
 
Last edited:

Felix_90

New Member
Hi anjali,
Please change the following lines:

5 Dim mailbox= _nameSpace (you need a capital „S“ and also a capital „D“ in Dim?)
11 is your Input „Outlook_Folder_ID“ set to 6? (6 is for Inbox)
21 this line is required, comment it in
25 in the bracket insert name instead of Destination_Folder -> .…=item.Move(name)....

And I never used the MsgBox function, so I don’t know if this can also cause problems. Maybe delete this lines.

I think you commented out 21 because it was not working due to the mistake in line 5. So adjust line 5, comment in line 21 and also adjust line 25

Please let me know, if this solved your problem.

PS.: Moving the Mail will sometimes result in the mail is only moved locally on the bot without syncing it to the exchange server. So other users won’t notice that the mail was moved. You can either solve this problem by triggering a sync after moving the mail or the better solution is to simply turn off “download shared folder” in outlook.

Regards
Felix
View attachment 1409540A-5161-4405-93AD-DCB357FB6C4C.jpeg
 

dhaneshpmenon

New Member
Hello Anjali,

Were you able to fix this issue? If yes, could you please let us know what change is to be done?

Best
 
Last edited:

Satya Manohar

New Member
Hi Anjali/ dhanesh,

Are you able to find any solution for this. I am also facing the issue. Not able to move mails from nested sub folders
 
Top