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


Outlook 2002:  Remove Private Sensitivity for All Messages Moved Into Specific Folder

Posted on 2009-02-20
Medium Priority
Last Modified: 2012-06-27
Outlook 2002  / Exchange 2003
I'm a novice VBA type, and would really appreciate any direction you can offer.
Is there a way to automatically change individual message sensitivity from Private to Normal as the messages are moved into a specific folder?  Or maybe a way to default the sensitivity level on the entire folder as Normal?
Question by:mlozen
  • 4
  • 3
LVL 76

Expert Comment

by:David Lee
ID: 23698089
Hi, mlozen.

The code below will do this.  It works on items in the Inbox, but can be modified to work on any folder.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of
5.  Outlook's VB Editor window
6.  Edit the code as needed.  I included comment lines wherever something needs to or can change
7.  Click the diskette icon on the toolbar to save the changes
8.  Close the VB Editor
9.  Click Tools->Macro->Security
10. Set the Security Level to Medium
11. Close Outlook
12. Start Outlook
13. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

Private WithEvents olkFolder As Outlook.Items
Private Sub Application_Quit()
    Set olkFolder = Nothing
End Sub
Private Sub Application_Startup()
    'Change the folder on the next line'
    Set olkFolder = Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub olkFolder_ItemAdd(ByVal Item As Object)
    If Item.Class = olMail Then
        Item.Sensitivity = olNormal
    End If
End Sub

Open in new window


Author Comment

ID: 23737474
I really appreciate your help, and I think I'm almost there, but I'm running into one problem.  When I run the macro, I get a Type Mismatch error on this line of code:

    Set olkFolder = Session.GetDefaultFolder("Mailbox - User Name\Inbox\Folder Name").Items

It's probably the way that I defined the folder name, but every variation I try results in the same error.  Sorry to make you deal with such an amateur, but if you could offer any insight into what I'm doing wrong in defining the folder name, I'd appreciate it.

Thanks much!
LVL 76

Expert Comment

by:David Lee
ID: 23738820
GetDefaultFolder takes a numeric parameter indicating which of Outlook's build-in folders it should retrieve.  It can't handle a string with a name.  To get a folder under the Inbox, use something like this:

    Set olkFolder = Session.GetDefaultFolder(olFolderInbox).Folders("Folder Name").Items
Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.


Author Comment

ID: 23739469
Great!  That addressed my folder issue.  Now, though, when the code runs, I receive a new error:

Run-time error  '-2147024809 (80070057)'
The sensitivity of this Private message cannot be changed.  Could not complete the operation.  One or more parameter values are not valid.

Debug takes me to this line of code:  Item.Sensitivity = olNormal
LVL 76

Accepted Solution

David Lee earned 1000 total points
ID: 23739776
I've never seen this documented anywhere, it's certainly not mentioned in the description of the Sensitivity property, but apparently Outlook doesn't allow changes to the sensitivity setting of received items.  I did find this explanation in a Microsoft page describing the effects of a setting of "private" for sensitivity

    The recipient cannot change the sensitivity setting ...

If Outlook won't allow a recipient to change the setting from the GUI, then it's not going to be possible from code either.  Apologies.  I'd never encountered this before and didn't see any restrictions on setting sensitivity in the documentation.

Author Comment

ID: 23740138

I was afraid that would be the case.  I really appreciate all the work you put into this.  I'll look for another solution.

Thanks again!
LVL 76

Expert Comment

by:David Lee
ID: 23740242
You're welcome.  Sorry I couldn't help  :-(  

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Today as you open your Outlook, you witness an error message: “Outlook is using an old copy of your Outlook Data File…”. Probably, Outlook is accessing an old OST file.
I came across an unsolved Outlook issue and here is my solution.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

873 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