Click here to Skip to main content
15,881,803 members
Articles / Desktop Programming / ATL
Article

Retrieving Profile and Service Store using Extended MAPI

Rate me:
Please Sign up or sign in to vote.
3.00/5 (8 votes)
6 Jul 2004CPOL3 min read 75.6K   816   30   12
This application is written to retrieve profile name and associated message stores.

Introduction

This code is written to retrieve existing profiles and and associated service/s. This app uses Extended MAPI for retrieval of this information.

I take no responsibility for support or any kind of issues that may arise with this code.

Overall, there are very less articles available for Extended MAPI, that's the reason I am putting this code. I have tested this code on Win2000 and Outlook XP. UI is not good for this project. After retrieval of the profiles and services, this app will show some message boxes and nothing else. These message boxes will be of Profile Name and Message Store Services. Still I am working on this code and will try to make it more attractive.

I welcome all Extended MAPI developers to pass comments on this code:

Here are some details:

To deal with the Extended MAPI, we need to know a few basic things. In the following paragraphs, I will try to explain these basics.

The MAPI structure is a complex structure that requires understanding of C / C++ even for basic implementation. The MAPI subsystem exposes various interfaces using which we can interact with it. The IProfAdmin is one of the interfaces exposed by MAPI. This description is focused on IProfAdmin.

To start with, we need "MAPIInitialize" function that initializes the global data of MAPI DLL and increments the reference to the MAPI Subsystem. Once the MAPI sub system is initialized, we need to take control of the profiles to work with them. To create the administration profile, we need to declare a variable of “LPPROFADMIN” type and create the administration profile using “MAPIAdminProfiles” function.

Once we have the Admin profile, we can work with the profiles with administrative privileges.

As a basic, the MAPI exposes various tables using which we can retrieve the MAPI data. For profiles, the MAPI exposes the Profile Table. Almost all tables can be declared as “LPMAPITABLE”.

The data is stored in the tables in the form of rows and columns. Again, to reach to the data, we need to get the row set, individual row, and then the actual properties.

The LPMAPITABLE has a function “GetRowCount” using which we can retrieve the count of the data rows. Similarly, using “QueryRows” function, row set can be retrieved. Here, the row set variable should be declared as “LPSRowSet”. The LPSRowSet is an array of the individual rows.

Using normal for / while / do while (whichever is applicable) loop, we can iterate through all rows. The individual row should be declared as “LPSRow”. Each row is an array of properties, and each property is of “LPSPropValue” type. The LPSPropValue has two members namely Property Tag and Property value. The property tag is of unsigned long type and value is a union.

Please refer MAPI documentation for the property tags. These are already defined in MAPITags.h file and these tags are self descriptive. E.g., PR_DISPLAY_NAME.

Once we have the property, then we can compare the required tag with the retrieved tag and get the property value from the property structure.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
Web Development:
.Net 2.0, VB.net, ASP.net, Classic ASP, VBScript, Javascript, HTML, DHTML,

OpenSource:
Perl, PHP, Linux, Apache, IIS.

Desktop Developement:
VB.net, VB 6, COM/DCOM, Winsock, MAPI, CDO, Outlook Object Model, LDAP, C, C++, Foxpro 2.5, Clipper.

Database:
MS SQL - Server, MySQL, PostgreSQL

Other:
Enterprise Architect, Microsoft Project, Rational Rose, UML.

Has Nine+ years of experience with IT and now working in Project Manager's Role.

Comments and Discussions

 
GeneralSick Pin
Shahid_2k_whiz13-Jul-06 23:58
Shahid_2k_whiz13-Jul-06 23:58 
QuestionDid you ever use idle routine? Pin
jvsun27-Jun-06 16:13
jvsun27-Jun-06 16:13 
GeneralSender's name Pin
AlexEvans27-Sep-05 13:48
AlexEvans27-Sep-05 13:48 
Questionsending email??? Pin
Saurabh_Delhi3-Jul-05 22:49
Saurabh_Delhi3-Jul-05 22:49 
GeneralUser and exchange information using Profile Pin
vikijain2-Feb-05 8:03
vikijain2-Feb-05 8:03 
Hi Chandrashekhar,
I have a requirement to retrieve the user (for which the MAPI profile has been created) and the Exchange server to which this MAPI profile points to.
Can you please guide how can I achieve this ?
Thanks in advance.
Piyush


GeneralNeed Help Pin
NILENDU19-Aug-04 9:39
NILENDU19-Aug-04 9:39 
GeneralRe: Need Help Pin
Chandrashekhar Kulkarni29-Aug-04 22:08
Chandrashekhar Kulkarni29-Aug-04 22:08 
GeneralArticle is Updated now !! Pin
Chandrashekhar Kulkarni9-Jul-04 5:23
Chandrashekhar Kulkarni9-Jul-04 5:23 
GeneralRe: Need Help Pin
NILENDU20-Aug-04 7:46
NILENDU20-Aug-04 7:46 
Generalarticle... Pin
Karl Josefsson9-Jul-04 2:26
Karl Josefsson9-Jul-04 2:26 
QuestionOk, but the article then? Pin
Karl Josefsson6-Jul-04 23:16
Karl Josefsson6-Jul-04 23:16 
AnswerRe: Ok, but the article then? Pin
Chandrashekhar Kulkarni8-Jul-04 21:19
Chandrashekhar Kulkarni8-Jul-04 21:19 

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.