[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

creating outlook subfolder from server side inbox rule

Posted on 2011-03-14
4
Medium Priority
?
1,619 Views
Last Modified: 2012-05-11
Hi guys,

With your help I already successfully created following rule:

new-inboxrule -name "eBrochure" -mailbox USER -MoveToFolder "USER:\eBrochure" -SubjectContainsWords "eBrochure:"

and it works pretty good. The question is: can I create a rule which will recreate the folder eBrochure if it is not exist in the receipient mailbox. Right now I'm getting error on the rule if it is no subfolder eBrochure on user's mailbox. I was using MAPILab Server side rules on my old Exchange 2003 servers and when Rule is in place and tagged email delivered to the mailbox - eBrochure subfolder recreated if user accidentaly deleted.

I already have custom managed folder eBrochure with applied retention policy on my new Exchange 2010 SP1 servers.

Please advice. Thank you in advance.

P.S. I found an alternative way via VBS logon script:

Set objOutlook = CreateObject("Outlook.Application")
Set myNameSpace = objOutlook.GetNamespace("MAPI")
Set myInboxFolder = myNameSpace.GetDefaultFolder(6)
Set myNewFolder = myInboxFolder.Folders.Add("eBrochure")

How to make it exit without the error if the folder already exist?
0
Comment
Question by:Armen Minasyan
  • 2
  • 2
4 Comments
 
LVL 49

Accepted Solution

by:
Akhater earned 2000 total points
ID: 35135303
on error resume next
Set objOutlook = CreateObject("Outlook.Application")
Set myNameSpace = objOutlook.GetNamespace("MAPI")
Set myInboxFolder = myNameSpace.GetDefaultFolder(6)
Set myNewFolder = myInboxFolder.Folders.Add("eBrochure")
0
 

Author Comment

by:Armen Minasyan
ID: 35137779
I modified it a little bit if someone needed - changed the subfolder location from Inbox into Mailbox itself:

On Error Resume Next
Set objOutlook = CreateObject("Outlook.Application")
Set myNameSpace = objOutlook.GetNamespace("MAPI")
Set myInboxFolder = myNameSpace.Folders(1)
Set myNewFolder = myInboxFolder.Folders.Add("eBrochure")
0
 
LVL 49

Expert Comment

by:Akhater
ID: 35137800
so did my "On error resume Next" did the trick ?
0
 

Author Comment

by:Armen Minasyan
ID: 35138158
Yes, it did. Thanks for your help!
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question