Click here to Skip to main content
15,892,161 members
Articles / Desktop Programming / MFC

Outlook 2000 bulk exporter

Rate me:
Please Sign up or sign in to vote.
3.75/5 (5 votes)
22 Nov 20013 min read 105.7K   1.5K   26  
Escape the confines of Outlook 2000
/*
    Copyright 2001 Justin Kirby
    This file is part of olexp.

    olexp is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    olexp is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with olexp; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/
#ifndef OLEXP_OLPARSER_H
#define OLEXP_OLPARSER_H


#include <string>
#include <vector>
#include "ProgressWnd.h"

class OLParser
{
public:
    enum OLTYPES{CALENDAR=1, CONTACTS=2, MESSAGES=0, JOURNAL=4, NOTES=5, TASKS=3};
public:
    OLParser();
    ~OLParser();

    //! AddTypes
    /*!
        This adds types of items to parse. Available types are:
        - olAppointment(1)
        - olContactItem(2)
        - olJournalItem(4)
        - olMailItem(0)
        - olNoteItem(5)
        - olPostItem(6)
        - olTaskItem(3)

        When you add a type, folders containing that type will be parsed
        and exported.

        NOTE: Assumption of homogenous folders
    */
    virtual void AddType(OLTYPES type);
    //! AddSource
    /*!
        This is the root MAPIFolder object. 
        Easiest way to grab this is to get a default folder
        and grab its parent

        NOTE: this doesn't _have_ to be the root object
        parsing will just recurse from this
    */
    virtual void AddSource(LPDISPATCH src);
    //! SetDestination
    /*!
        The directory to dump all the exported files
        NOTE: It must already exist
    */
    virtual void SetDestination(CString &dest);
    //! Parse
    /*!
        Start parsing the source folder
    */
    virtual void Parse();
protected:
    //! parse
    /*!
        The recursive function. Parses all items in
        this and then decends into itself
    */
    virtual int Parse(LPDISPATCH disp);
    //! TypeValid
    /*!
        Determines whether the folder's default type
        is valid according to what was put in via 
        AddType()
    */
    virtual bool TypeValid(OLTYPES tp);
    //! CreateDest
    /*!
        This will create all necessary subfolders if they do not exist.
        Essentially the directory structure will end up mirroring the
        tree in Outlook
    */
    virtual bool CreateDest();
    //! WriteDest
    /*!
        Basically take the content and dump it to name

        This writes to a file
    */
    virtual bool WriteDest(CString &nm, CString &content);
protected:
    typedef std::vector<OLTYPES> types;
    typedef std::vector<LPDISPATCH> source;
    /*!The vector of types to export*/
    types m_types;
    /*! Vector of sources*/
    source m_sources;
    /*! Destination, e.g. where we put everything*/
    CString m_dest;
    /*! Progress window for pretty UI crap*/
    CProgressWnd *p_prog;


};

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions