JohnPell
asked on
How do I check for an outlook folder and create it if it does not exist?
Hello, I would like to write a VB Script to be able to check for a folder in Outlook, Under the users mailbox, (Pelletier, John - Mailbox) and if it does not exist, create it.
ASKER
Thanks for the response, however these examples are in VBA and don't really cover what I need.
What language do you need it in, and what are the exact steps you need to cover?
Rob.
Rob.
ASKER
VB Script, found something from "The Scripting Guy" and wrote the below, which works.
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Appl ication")
Set objNamespace = objOutlook.GetNamespace("M API")
Set objFolder = objNamespace.GetDefaultFol der(olFold erInbox)
strFolderName = objFolder.Parent
Set objMailbox = objNamespace.Folders(strFo lderName)
On Error Resume Next 'Mailbox already exists
Set objNewFolder = objMailbox.Folders.Add("Im portToCall ")
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Appl
Set objNamespace = objOutlook.GetNamespace("M
Set objFolder = objNamespace.GetDefaultFol
strFolderName = objFolder.Parent
Set objMailbox = objNamespace.Folders(strFo
On Error Resume Next 'Mailbox already exists
Set objNewFolder = objMailbox.Folders.Add("Im
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I really appreciate your taking the time to answer!
No worries. Thanks JohnPell.
Rob.
Rob.
http://www.outlookcode.com/threads.aspx?forumid=5&messageid=7923
http://www.outlookcode.com/d/code/quarexe.htm
Regards,
Rob.