Solved

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

Posted on 2006-07-12
1
818 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 17095041
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Mailbox Overload?
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

687 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