Click here to Skip to main content
Click here to Skip to main content

Retrieving Profile and Service Store using Extended MAPI

By , 6 Jul 2004
 

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)

About the Author

Chandrashekhar Kulkarni
Web Developer
India India
Member
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.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralSickmemberShahid_2k_whiz13 Jul '06 - 23:58 
This article is a sick joke to any new begineer. it explains nothing and is plain gibberish.D'Oh! | :doh:
 
asdfasd
QuestionDid you ever use idle routine?memberjvsun27 Jun '06 - 16:13 
If you know well about idle routine, please give me a hand ?
 
Keyword: FtgRegisterIdleRoutine, MAPIInitIdle.
GeneralSender's namememberAlexEvans27 Sep '05 - 13:48 
MAPIEx - Using Delegates
 
Environment – Windows XP, .NET 2003, MS-Office / Outlook 2003 installed
 
I am trying to implement an automated email – send message from a user application, without it being identifying the actual user, but sending it as if it was sent from a “Generic” name – the “Help Desk”
 
It all seems to work fine, the hRes is S_OK, BUT the recipient of the message still see the actual name of the person sending the message, subsequently – instead of just calling the “Help Desk” they try to call that specific person and insist to talk to them…
 
What am I doing wrong here?
 
Hope someone can help me
Thanks
Alex
 
SPropValue prop;
prop.ulPropTag = PR_DISPLAY_NAME;
prop.Value.LPSZ = _T(“Help Desk”);
hRes = m_pMessage->SetProps(1,&prop,NULL);

Questionsending email???memberSaurabh_Delhi3 Jul '05 - 22:49 
Hi.
 
This is a good article.
Anybody has a smple code to send a simple email using extended mapi. i f so pls can anybody give me that code. it will help me in implementing other properities of exchange server.
 
thanks.
GeneralUser and exchange information using ProfilesussPiyush_jain282 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 HelpsussNILENDU19 Aug '04 - 9:39 
Hello ,
 
I am using ipSericeAdmin pointer to create a new profile but when i try to
 
lpServiceAdmin->ConfigureMsgService(....)
 
I get an error message.
Can you please suggest what could be the problem? Is it a lack of permission problem?
GeneralRe: Need HelpmemberChandrashekhar Kulkarni29 Aug '04 - 22:08 
Can you please describe your problem with aditional code snippet ? What error u get ? In general what processing you are doing and what is the declaratio part of your code ?
GeneralArticle is Updated now !!memberChandrashekhar Kulkarni9 Jul '04 - 5:23 
Hi,
 
I have updated the Article now. Please let me know if any further changes are required in it. I shall do that. As a second priority I am working on the code now and shall try to make it better by giving good user interface.
 
Best Regards,
Chandrashekhar.Unsure | :~
GeneralRe: Need HelpsussNILENDU20 Aug '04 - 7:46 
Hello ,
 
I am using ipSericeAdmin pointer to create a new profile but when i try to
 
lpServiceAdmin->ConfigureMsgService(....)
 
I get an error message.
Can you please suggest what could be the problem? Is it a lack of permission problem?
 

Generalarticle...membervirtually_void9 Jul '04 - 2:26 
Hi there,
 
The idea is good and I fully support the thought, but since we all know that MAPI is complex, you need to supply a proper article where you describe what you are doing and how it works, otherwise, the people reading your code will not understand how it works, they will just know that these couple of lines will list the profiles.
 
I wrote an article some time ago (http://www.codeproject.com/Purgatory/Outlook-addin.asp), it's en extremely long article and I guess that there are not that many developers here that work with MAPI because it didnt get rated very well, although I explained stuff in a very long and basic way...anyhow...
 
Keep up the good work and I'm looking forward reading more articles about MAPI.
 
/Karl
QuestionOk, but the article then?membervirtually_void6 Jul '04 - 23:16 
Hi there,
 
The code is ok, there are not 200 ways of doing this, but the code is fine.
But the article is not what I would call an article.
I dont mean to be rude, but this is an increasing problem here at codeproject.
 
The article should explain the code, the logic, how and why, the pitfalls if any, etc etc, not just 5 lines saying here's the code, enjoy.
 
I've been working with MAPI for a number of years and I know how hard it was to get going. Articles about complex subjects must have a high quality, I.e. explain everything in detail, how it works, and what you can and can't do with it.
 
Please consider updating the article and I will wote for it. Sometimes it might be hard to write an article, but we all have to make the effort to maintain the high quality of codeproject.
 
Keep up the good work and best of luck,
 
Karl
AnswerRe: Ok, but the article then?memberChandrashekhar Kulkarni8 Jul '04 - 21:19 
Karl,
 
Thank you very much for the suggestion. I shall try my level best to improve the article.
 
Here my basic intenstion behind the article is, the new developers who are trying to work on the MAPI, they should get a some idea about how to write the MAPI code !!
 
Anyways, This may be a justification, BUT I'll try and improve the code / Article.
 
Thanks for the inputs,Smile | :)
 
Regards,
Chandrashekhar.

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 7 Jul 2004
Article Copyright 2004 by Chandrashekhar Kulkarni
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid