VBScript Move sent mail to non-default folder

Status
Not open for further replies.

Mark White

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Hi,
I'm trying to move a sent email from the sent box to an other shared mailbox subfolder.

I can't use VBA as macros are disabled and am finding it difficult to change the GetFolderPath() function to work in VBScript.
Below is how I call it but I'm having trouble converting the VBA code into VBScript...

Does anyone have that functionality that allows traversing the folders that they could share with me?
Cheers
Mark

Dim sTarget, sSubject
Dim olApp, olNS, olMsg, olFldr

sTarget = WScript.Arguments(0)
sSubject = WScript.Arguments(1)

Set olFldr = GetFolderPath(sTarget) '****************

Set olApp = GetObject(,"Outlook.Application")
Set olNS = olApp.getNamespace("MAPI")
For each olMsg in olNS.getDefaultFolder(5).Items
If olMsg.Subject = sSubject Then
olMsg.move olFldr
End If
Next
Set olMsg = nothing
Set olNS = nothing
Set olApp = nothing

WScript.StdOut.WriteLine "Done"
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Mark White VBScript Move sent mail to non-default folder Outlook VBA and Custom Forms 5
A VBscript stops running after updating form Outlook VBA and Custom Forms 1
B VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
M VbScript for Command Button on Contacts Custom Form Using Outlook 1
M Forward Appointment as BCC with VBScript Outlook VBA and Custom Forms 7
D Security patch seems to kill vbscript on Enterprise Level Outlook VBA and Custom Forms 4
R VBScript Commands Outlook VBA and Custom Forms 2
S my vbscript button1_click code works on appointment created but not on opening an existing apntmn Outlook VBA and Custom Forms 16
JorgeDario Template oft that contains VBScript Is not running Using Outlook 1
J Outlook 2010 VBScript editor does not run code at all Outlook VBA and Custom Forms 0
T Create new item in public folder using VBscript Outlook VBA and Custom Forms 1
R VBScript Sendmail not selecting correct 'from' address Outlook VBA and Custom Forms 3
B Recommended Outlook & VBScript Books? Outlook VBA and Custom Forms 3
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
K VBScript Outlook, add attachment Outlook VBA and Custom Forms 1
S VBA Macro to VBScript Outlook VBA and Custom Forms 1
E VBScript to replace module? Using Outlook 3
F VBScript to add pre defined text Using Outlook 5
D Custom form and VBScript Using Outlook 5
F VBScript copy contacts and remove duplicates Using Outlook 1
R VBA Macro to VBScript in a form- Help Please! Using Outlook 10
H Accessing a control on a frame in Outlook with VBScript Outlook VBA and Custom Forms 1
Y Creating a Task with VBScript Outlook VBA and Custom Forms 14
N VBScript does not run in Outlook 2003 Outlook VBA and Custom Forms 4
H Move Selected emails to Local Drive Outlook VBA and Custom Forms 0
A Search folder and move the email Outlook VBA and Custom Forms 0
A Outlook 365 (OutLook For Mac)Move "On My Computer" Folder Items From Old To New Mac Computer Using Outlook 4
HarvMan Outlook 365 - Rule to Move an Incoming Message to Another Folder Using Outlook 4
humility36 Cannot move emails to archive - 440 error Outlook VBA and Custom Forms 1
B Outlook 2019 Automatically move email after assigning category Using Outlook 4
C Trying to move messages between imap accounts/folders Using Outlook 5
M Move command Outlook VBA and Custom Forms 11
C Code to move mail with certain attachment name? Does Not work Outlook VBA and Custom Forms 3
B Move emails from one account to another Outlook VBA and Custom Forms 2
J Quick steps delete original email and move reply/sent email to folder Using Outlook 2
N How to add or delete items to Move dropdown Menu Using Outlook 0
Commodore Unable to move message Using Outlook 3
N Line to move origEmail to subfolder within a reply macro Outlook VBA and Custom Forms 0
C Move or copy from field to field Outlook VBA and Custom Forms 0
T Outlook 365 Move newly created tasks automatically on save. Outlook VBA and Custom Forms 1
NVDon Create new Move To Folder list Outlook VBA and Custom Forms 0
P Print attachments automatically and move the mail to an existing folder called "Ted" Outlook VBA and Custom Forms 4
T Macro to move reply and original message to folder Outlook VBA and Custom Forms 6
F VBA to move email from Non Default folder to Sub folders as per details given in excel file Outlook VBA and Custom Forms 11
F Excel VBA to move mails for outlook 365 on secondary mail account Outlook VBA and Custom Forms 1
J Dopey move - deleted profile Using Outlook 1
GregS Outlook 2016 Move Outlook to new computer? Using Outlook 4
Witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 7
G Move tasks up/down todo list by VBA Outlook VBA and Custom Forms 1
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0

Similar threads

Back
Top