Click here to Skip to main content
13,192,426 members (50,981 online)
Click here to Skip to main content
Add your own
alternative version


15 bookmarked
Posted 12 Apr 2007

Programmatically Make Folder in Outlook by using addins

, 23 Apr 2007
Rate this:
Please Sign up or sign in to vote.
Making Folder in outlook 2000 by using ATL addins in VC++6.0.


This article is based on the ATL addin for outlook, and Pro grammatically Making Folder in Outlook by using addins.


Understanding how to create addins and Making Folder in outlook 2000 by using ATL addins in VC++6.0.

Using the Code

Steps Involves :-

  1. First open VC++6.0 and ATL COM App Wizard and write name of project MakeFolder.
  1. Insert ATL sample object by using ATL object Wizard. Name of interface Interface_Folder which is derived from Idispatch interface.
  2. Implement Interface from Microsoft add designer type Libraries

Screenshot - image001.jpg
Screenshot - image002.jpg

  1. Choose _ IDTExtensibility2 and press ok button for implement interface.

Screenshot - image003.jpg

  1. Paste code in the OnConnection event .
"STDMETHOD(OnConnection)(IDispatch * Application, ext_ConnectMode ConnectMode,
     IDispatch * AddInInst, SAFEARRAY * * custom)
    ::MessageBox (0,"This is Make Folder addin","Make folder addin",0);
    CComQIPtr <Outlook::_Application> spApp(Application); 

    CComPtr <Outlook::_NameSpace> olNs;
    CComQIPtr <Outlook::_Folders> spMainFolderList;
    CComQIPtr <Outlook::_Folders> spPersonalFolderList;
    CComQIPtr <Outlook::MAPIFolder> spPersonalFolder;
    CComQIPtr <Outlook::MAPIFolder> spNewFolder;

    // Folder type can be any of the following:
    // MailItems IPF.Note
    // ContactItems IPF.Contact
    // AppointmentItems IPF.Appointment
    // NoteItems IPF.StickyNote
    // TaskItems IPF.Task
    // JournalItems IPF.Journal

    CComVariant varFolderType("IPF.Note");
    CComBSTR bstr_temp("test_folder_Name"); //Name of folder

    //Start a MAPI Session
    CComQIPtr <Outlook::_Application> m_spOutlookApp(Application); 

    m_spOutlookApp = spApp; 


    if(olNs == NULL)
        return -1;

    //Get the folder list of the current session
    //Get the first folder (this should be the Personal Folders)

    //Get the folder list of the Personal Folders folder
    //Add to the personal folder list.
    spPersonalFolderList->Add(bstr_temp, varFolderType,&spNewFolder); 

    return E_NOTIMPL;
  1. Open .reg file for registry from file view and paste this code after wizard generate code It is important for Calling COM dll
                            val FriendlyName = s 'MakeFolder My Addin'
                                val Description = 
                                    s 'MakeFolder MY Outlook Addin'
                                val LoadBehavior = d '00000003'
                                val CommandLineSafe = d '00000000' 
  1. Paste on stdafx.h file and changes path according to your PC MSoffice setting.
#import "C:\Program Files\Microsoft Office\Office\MSOUTL9.olb" 
    rename_namespace("Outlook"), named_guids, raw_interfaces_only

using namespace Outlook;

Points of Interest

welcome all suggestion and quires for error and improvement on this small Artical.

Error Solution for Help

if (InlineIsEqualGUID(*arr[i],riid))

please replace by

if (ATL::InlineIsEqualGUID(*arr[i],riid))


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

You may also be interested in...


Comments and Discussions

GeneralDude, your images don't show Pin
babalao13-Apr-07 4:04
memberbabalao13-Apr-07 4:04 
GeneralRe: Dude, your images don't show Pin
ashu_om15-Apr-07 20:08
memberashu_om15-Apr-07 20:08 
Generalhi all Pin
ashu_om12-Apr-07 20:53
memberashu_om12-Apr-07 20:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171017.2 | Last Updated 23 Apr 2007
Article Copyright 2007 by ashu_om
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid