Solved

VBA: How to create a personal folder in Outlook using VBA

Posted on 2006-07-12
1
805 Views
Last Modified: 2008-03-10
Hi,

I have to create a personal folder using VBA.  Any idea how can I acheive the same programmatically ?

I don't need the manual methods as I am also aware of the same.

Please let me know some script/code for creating a personal folder. Any appropriate link is also sufficient.

Regards,
Vikas.
0
Comment
Question by:TiwariVikas
1 Comment
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
Greetings, TiwariVikas.

Use the AddStore method of the NameSpace object.  Here's a function I wrote for another question that creates an archive (PST) file for a given year.  I've added comments to help make sense of it.

Sub CreateYearlyPST(strYear As String, strArchiveFileName As String)
    Dim olkNS As Outlook.NameSpace, _
        olkFolder As Outlook.MAPIFolder
    'Create a NameSpace object
    Set olkNS = Application.GetNamespace("MAPI")
    'Create the new PST file using the name passed
    olkNS.AddStore strArchiveFileName
    'Get the root folder in the new PST file.  OpenMAPIFolder is a custom function.  I can post the code if you need.
    Set olkFolder = OpenMAPIFolder("\Personal Folders")
    'Create a fodler called Inbox
    olkFolder.Folders.Add "Inbox", olFolderInbox
    olkFolder.Name = strYear
    olkNS.RemoveStore olkFolder
    Set olkFolder = Nothing
    Set olkNS = Nothing
End Sub

Cheers!
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now