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.
Top