Fix OpenChange server code and access to Samba4 databases.
[OpenChange-git-clone.git] / libmapi++ / message_store.h
blob889e7bb003b95370ce9fcc65d8b49185a70d742f
1 /*
2 libmapi C++ Wrapper
3 Message Store Class
5 Copyright (C) Alan Alvarez 2008.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef LIBMAPIPP__MESSAGE_STORE_H__
23 #define LIBMAPIPP__MESSAGE_STORE_H__
25 #include <stdint.h>
27 #include <libmapi++/clibmapi.h>
28 #include <libmapi++/mapi_exception.h>
29 #include <libmapi++/object.h>
31 namespace libmapipp
33 class session;
35 /**
36 * \brief This class represents the Message Store in Exchange.
38 * The message_store is the grouping of message folders (which could be the
39 * users private store including mail, calendar, todo list, journal, contacts
40 * and so on) or could be the public store (e.g. shared public folders).
42 * It is not possible for you, the user, to create a message_store object.
43 * Instead, you should retrieve the message_store associated with a session
44 * using session::get_message_store()
46 class message_store : public object {
47 public:
48 /**
49 * \brief Retrieves the folder id for the specified default folder in the Message Store.
51 * \param id The type of folder to search for.
53 * The following types of folders are supported:
54 * - olFolderTopInformationStore
55 * - olFolderDeletedItems
56 * - olFolderOutbox
57 * - olFolderSentMail
58 * - olFolderInbox
59 * - olFolderCalendar
60 * - olFolderContacts
61 * - olFolderJournal
62 * - olFolderNotes
63 * - olFolderTasks
64 * - olFolderDrafts
66 * If you are trying to enumerate all folders, you should open the
67 * olFolderTopInformationStore, and then get the hierarchy container for
68 * that top level folder.
70 * \return The resulting folder id.
72 mapi_id_t get_default_folder(const uint32_t id) const throw(mapi_exception)
74 mapi_id_t folder;
76 if (GetDefaultFolder(const_cast<mapi_object_t*>(&m_object), &folder, id) != MAPI_E_SUCCESS)
77 throw mapi_exception(GetLastError(), "message_store::get_default_folder() : GetDefaultFolder");
79 return folder;
83 private:
84 friend class session;
85 message_store(session& mapi_session) throw() : object(mapi_session, "message_store")
88 void open(mapi_session *mapi_session) throw(mapi_exception)
90 if (OpenMsgStore(mapi_session, &m_object) != MAPI_E_SUCCESS)
91 throw mapi_exception(GetLastError(), "message_store::open() : OpenMsgStore");
94 ~message_store() throw()
99 } // namespace libmapipp
101 #endif //!LIBMAPIPP__MESSAGE_STORE_H__