Welcome to MSDN Blogs Sign in | Join | Help

MAPI and Exchange 2007

Most of you have realized by now that Exchange 2007 doesn't include MAPI "in the box". We're supporting two ways to put MAPI on an Exchange 2007 server:

Some of you have noticed as well that with Exchange 2007, you don't have to have a Public Folder store. What happens when you try to connect to an Exchange 2007 server that doesn't have a Public Folder store?

With Outlook 2007, you connect with no problem. Earlier versions of Outlook get this error:

"Your Exchange Server administrator has blocked the version of Outlook that you are using. Contact your administrator for assistance."

MAPI applications will get the error MAPI_E_FAILONEPROVIDER if they're using any version of MAPI except the version supplied by Outlook 2007.

So what's a developer to do? Are you locked in to Outlook 2007's MAPI? Why did we provide a MAPI download if it won't even work?

Introducing CONNECT_IGNORE_NO_PF

Exchange 2007 blocks all MAPI providers earlier than Outlook 2007 when Public Folders are not available. This is because all of the earlier clients assume Public Folders will be available and will experience failures if allowed to connect. For customers whose code does not depend on Public Folders, a new flag has been made available to allow this check to be bypassed.

Right now, the only version of MAPI which supports this new flag is the MAPI download.

Details on the new flag:

#define CONNECT_IGNORE_NO_PF ((ULONG)0x8000)
This is set in the PR_PROFILE_CONNECT_FLAGS property on the global profile section.

The global profile section can be accessed by calling OpenProfileSection with pbGlobalProfileSectionGuid, which is defined in edkmdb.h.

When this flag is set, Exchange 2007 will not check if public folders are available when logging on. Use of this flag can be demonstrated with MAPI Editor:

  1. Install the new MAPI download
  2. In MAPI Editor, do Profile/Show Profiles and open the profile you wish to work on
  3. Locate the MSEMS service and open it
  4. Locate the profile section with the PR_PROVIDER_UID of 13DBB0C8AA05101A9BB000AA002FC45A and single click on it
  5. In the lower pane, locate PR_PROFILE_CONNECT_FLAGS
  6. Edit this property to OR in the new flag. So for instance, if it previously had 0x2 in there, it would now have 0x8002
  7. Close all the profile windows and attempt to log on

Caveats

  • Even with this flag you won't be able to use Public Folders (they don't exist) so any errors attempting to open or reference them would be expected.
  • Both the client side MAPI binaries and the Exchange store need to be aware of the flag for it to work.
  • Builds of MAPI that understand this flag are the one from the download only and Exchange 2003 06.05.09.7652 or higher (KB 929751)
  • Builds of the Exchange store that understand this flag are Exchange 2007 and Exchange 2003 06.05.09.7652 or higher (KB 929751)
  • The build of CDO included in the download will automatically set this flag on dynamic profiles.
  • Previous versions of Exchange may not understand this flag, so be sure only to set it when logging on to an Exchange 2007 mailbox.

Update - 4/17/07 Removed inadvertent assertion that there is a build of Exchange 2003 MAPI that understands this flag. If such a build does become available I'll update again.

Published Monday, March 19, 2007 3:08 PM by Stephen Griffin

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: MAPI and Exchange 2007

Steve,

Can you disclose how exchange is verifying the outlook version?

Could we as developers change the version in the profile to be 2007 and remove the public folder provider from the profile?

For that matter, why can't we just remove the PF provider and have downlevel clients work?

I agree that the default for older clients is to have a PF provider in the profile, but it seems unfair that no check is made to determine if a PF provider even exists before failing on the profile.

Regards,

Eriq

Tuesday, March 20, 2007 3:20 PM by Eriq VanBibber

# re: MAPI and Exchange 2007

Outlook on an Exchange Server?

Steve, maybe i am misinterpreting your comments.

In previous releases it was strongly cautioned against deploying Outlook on an exchange server because of the mapi stub.

Is this no longer the case?  Can outlook 2007 be installed on a 2007 exchange server without issue?

-Eriq

Tuesday, March 20, 2007 3:24 PM by Eriq VanBibber

# re: MAPI and Exchange 2007

That we support putting Outlook 2007 on an Exchange 2007 server should be in the release notes. Dave blogged about it here:

http://blogs.msdn.com/dgoldman/archive/2007/02/27/installing-outlook-2007-on-an-exchange-2007-server.aspx

The version number that Exchange gets is actually the version of the emsmdb32.dll binary, so you won't be able to "set" it.

Tuesday, March 20, 2007 3:45 PM by Stephen Griffin

# re: MAPI and Exchange 2007

Steve,

which methods will return MAPI_E_FAILONEPROVIDER in case of the version mismatch? Is it on the first call that causes an RPC?

Wednesday, March 21, 2007 12:46 PM by Dmitry Streblechenko

# re: MAPI and Exchange 2007

Dmitry - Good question - it's on OpenMsgStore. If you play around with this, you'll probably see that AB access still works.

Wednesday, March 21, 2007 2:07 PM by Stephen Griffin

# re: MAPI and Exchange 2007

Steve,

Does 'the MAPI Download' still use the 'stubbed' approach as previous versions?

Wednesday, March 21, 2007 3:15 PM by Eriq VanBibber

# re: MAPI and Exchange 2007

The MAPI download installs Exchange's MAPI32.dll directly into system32 - it does not use the stub.

Wednesday, March 21, 2007 3:49 PM by Stephen Griffin

# re: MAPI and Exchange 2007

Steve,

speaking of versions, versions of Outlook prior to 2007 used to set the PR_PROFILE_SERVER_VERSION in the global profile section.

I don't think Outlook 2007 does that anymore in neither cached nor online mode.

Is the Exchange server version still stored somewhere?

Saturday, March 24, 2007 2:30 PM by Dmitry Streblechenko

# Why Can't I Open The Mailbox?

Following up on my previous article on CONNECT_IGNORE_NO_PF , I had a customer recently who claimed MAPI

Thursday, March 29, 2007 5:18 PM by SGriffin's [MSFT] WebLog

# re: MAPI and Exchange 2007

Dmitry - there IS a new prop (in the same place as the old one), but it's not documented (yet). I'm sure you'll be able to find it. :)

Friday, March 30, 2007 10:17 AM by Stephen Griffin

# re: MAPI and Exchange 2007

We have an EDK based MAPI connector with Exchange 2000/2003. How do you use it on Exchange 2007 ? Can i use it or no ?

Any help is appreciated...

Wednesday, May 02, 2007 12:33 PM by NjDude

# re: MAPI and Exchange 2007

You can't - but you don't need to either. Exchange 2007 has a much simpler mechanism for building connectors. See the documentation on Foreign Connectors: http://technet.microsoft.com/en-us/library/aa996779.aspx

Friday, May 04, 2007 10:28 AM by Stephen Griffin

# re: MAPI and Exchange 2007

Hi,

The download MAPI works fine for the 'old-format' PST but does not work for Outlook 2003/2007 format. IMsgServiceAdmin->ConfigureMsgService() returns MAPI_E_EXTENDED_ERROR. I read in some other blog that Exchange 2007 SP1 will provide functionality to export/import also the new PST. Is this anyhow related with the standalona MAPI and will this be enhanced to support new SPT format too?

Friday, May 11, 2007 9:47 AM by TomazB

# re: MAPI and Exchange 2007

The download is Exchange's MAPI, which only includes an ANSI PST provider. What you're looking for is the Unicode PST provider - don't hold your breath waiting for it to show up in the download.

Friday, May 11, 2007 2:08 PM by Stephen Griffin

# re: MAPI and Exchange 2007

What else has to happen to the profile? I am creating a brand new profile and now when OpenMsgStore() is called, I receive a unconfigured profile error (8004011C) instead of the 011D.

Even if I stop my program and manually update the profile in the middle I will get this error.

It seems like the profile isn't getting fully saved before the update happens. I'm just not sure what is wrong, the code works with Ex2007 with public folders, Ex2003, Ex2000, even 5.5.

Do you have any sample code to show the process of updating the PR_PROFILE_CONNECT_FLAGS?

Tuesday, June 19, 2007 2:53 AM by kevin

# re: MAPI and Exchange 2007

kevin - did you try the steps I gave for MFCMAPI? They describe exactly what you need to do.

Tuesday, June 19, 2007 9:25 AM by Stephen Griffin

# re: MAPI and Exchange 2007

In my exchange 2007 setup even after downloading "ExchangeMapiCdo.EXE" MAPI code is failing during GetMessageStore with error code "HRESULT: 8004011d" .  Any idea whats wrong?

Regards,

Shivaraj

Wednesday, July 25, 2007 1:53 AM by shivaraj

# re: MAPI and Exchange 2007

I can only guess you didn't set CONNECT_IGNORE_NO_PF correctly on the profile.

Wednesday, July 25, 2007 9:33 AM by Stephen Griffin

# Changes in the newest CDO web download allow more options for CONNECT_IGNORE_NO_PF

If you've been bit by the problems with the web download of CDO 1.21 returning a 8004011D when trying

Tuesday, August 07, 2007 11:41 AM by Taking the mess out of Messaging Development

# re: MAPI and Exchange 2007

Stephen, is there a true 64 bit version of MAPI32.dll for use with x64 applications?  We are running a 64 bit app and MAPIInitialize returns E_FAIL.  The MAPI/CDO download for Exchange 2007 does not fix this either

Thursday, September 06, 2007 4:19 PM by John Young

# re: MAPI and Exchange 2007

MAPI is 32 bit only. We don't make a 64 bit MAPI right now.

Thursday, September 06, 2007 4:55 PM by Stephen Griffin

# re: MAPI and Exchange 2007

Hello Stephen, do we have any opportunity to install .PST provider without Outlook. If yes, how we can do this? And another one what is the latest version of pst provider is available for NT4?

Monday, October 01, 2007 1:58 PM by mvd

# re: MAPI and Exchange 2007

Exchange's MAPI includes an ANSI only PST provider. As for NT4 - um - maybe you could install the Exchange 5.5 system manager?

Monday, October 01, 2007 2:03 PM by Stephen Griffin

# Personal Store (PST) without Outlook

Is there a way to access Personal Store (PST) wihtout having Outlook installed? Reason: Take out the

Thursday, December 13, 2007 3:14 PM by Nayan's [MSFT] Blog

# re: MAPI and Exchange 2007

One quick question regarding the MAPI download. Is it true, that this version of mapi32.dll does not return the STORE_UNICODE_OK flag in the PR_STORE_SUPPORT_MASK property? Even if the store supports UNICODE, the flag is never set. Forcing MAPI_UNICODE works as expected, but how can i find out if a store is really UNICODE capable?

Wednesday, March 12, 2008 7:23 AM by Vladimir Werskov

# re: MAPI and Exchange 2007

I looked in the code and it doesn't appear Exchange's implementation of MAPI is aware of the STORE_UNICODE_OK flag. As far as MAPI_UNICODE is concerned, calls that don't support it will always let you know...

Wednesday, March 12, 2008 9:53 AM by Stephen Griffin

# Getting a Referral From Exchange 2007

One of my customers reported that using the MAPI download , they were unable to get a referral from Exchange

Monday, July 14, 2008 11:09 AM by SGriffin's [MSFT] WebLog

# re: MAPI and Exchange 2007

Hi,

I have modified the user profile as you said (using MFCMAPI) but when i try to get the store mailbox table on exchange server 2007 i get the error for HrQueryAllRows function :

"MAPI_E_NOT_INITIALIZED == 0x80040605".

The user has admin privileges and I even tried with the administrator also.

I am getting this error after logging in and got the IEXCHANGEMANAGER and the when i use HrQueryAllRows function. I thought something must be wrong with my code so i used MFCMAPI. it also gives the same error:

"MAPI_E_NOT_INITIALIZED == 0x80040605

Function m_lpContentsTable->QueryColumns( 0, &lpOriginalColSet)"

What might be the problem?

Thursday, August 28, 2008 4:32 AM by vikram

# re: MAPI and Exchange 2007

I've seen people follow the steps incorrectly and set the prop on the wrong profile section. Try again, and make sure to follow each step carefully. Do not use "Open Profile Section" as a shortcut.

Also - after you set the flag, make sure the hex value is 0x8002.

Thursday, August 28, 2008 7:14 AM by Stephen Griffin

# re: MAPI and Exchange 2007

Yes I have double checked the steps for modifying and also verified the PR_PROVIDER_UID of 13DBB0C8AA05101A9BB000AA002FC45A. I opened the correct profile, and there was only one service : MSEMS. After modifying the flag i verified that the value is 0x8002. but still i get the same error.

Is it the problem with server configuration or am i missing some dll files?

Thursday, August 28, 2008 7:45 AM by vikram

# re: MAPI and Exchange 2007

Hello, I was just looking at the MAPI download link and was wondering if Microsoft has plans to release versions other than English? Just wondering cause of the PR_LOCALE_ID chicken/egg issue in which MAPILogonEx changes the value to what the DLL language is and you can't get the previous PR_LOCALE_ID value without doing a logon so you can set it back to what it should be.  Thanks!

Wednesday, October 22, 2008 2:00 PM by ppeleshok

# Referral Madness

I've had a few customers lately getting hangs using Exchange's MAPI to talk to Exchange. Their specific

Monday, November 17, 2008 7:40 PM by SGriffin's MAPI Internals

# re: MAPI and Exchange 2007

Hi,

Maybe this is the wrong forum, but I'm stumped to find the right one. I am trying to send a Task Request through the MAPI. Is it possible? if so, how?

Sunday, December 07, 2008 9:12 PM by Joe

# re: MAPI and Exchange 2007

It is possible, but you'll need to read through the Exchange protocol documentation to figure out what you need to do. Start by looking at the MSDN article on creating task items: http://msdn.microsoft.com/en-us/library/cc963264.aspx

Monday, December 08, 2008 9:42 AM by Stephen Griffin

# re: MAPI and Exchange 2007

I'm using the recent MAPI CDO library (6.5.8069.0) for connecting to an Exchange Server 2007 without a public folder.

If I edit the PR_PROFILE_CONNECT_FLAGS using MFC MAPI program, both the MFC MAPI and my program can connect via this profile, it works. But when i change the flag programmatically, i get MAPI_E_FAILONEPROVIDER from OpenMsgStore.

The windows account and the mail account are the same (administrator)..

 I call MapiLogonEx, change the flags and then try to open the message store. Is it about the order of methods? When exactly i should change the flag?

Thursday, July 23, 2009 5:12 AM by cash

# re: MAPI and Exchange 2007

Cash - you shouldn't be logging on to the profile first. All the modifications should happen before you log on. Take a look at the source for gcreconnect if you want to see code that sets this flag.

Thursday, July 23, 2009 7:45 AM by Stephen Griffin

# re: MAPI and Exchange 2007

Using GcReconnect code, I've written the code below. Although it seems to change the flag to 0x8002, OpenMsgStore still fails with MAPI_E_FAILONEPROVIDER.

MAPIAdminProfiles(0, &lpProfAdmin);

lpProfAdmin->AdminServices((LPTSTR)Profile,

NULL,

NULL,

0,

&lpSvcAdmin);

SvcAdminOpenProfileSection(lpSvcAdmin,(LPMAPIUID)&pbGlobalProfileSectionGuid, NULL, MAPI_MODIFY, &lpGlobalProfSect);

SizedSPropTagArray(1,sptTags) = {1, PR_PROFILE_CONNECT_FLAGS};

hRes = lpGlobalProfSect->GetProps((LPSPropTagArray) &sptTags, 0, &ulValues, &pPropArray);

if (SUCCEEDED(hRes) && (MAPI_W_ERRORS_RETURNED != hRes))

{

      pPropArray[0].Value.ul |=  

      CONNECT_IGNORE_NO_PF;

      hRes = lpGlobalProfSect->SetProps(1,  

      pPropArray, NULL);

}

else

{

}

if (FAILED(hr = lpGlobalProfSect->SaveChanges(FORCE_SAVE)))

{

}

And then...

MAPILogonEx(0,cProfile,"",ulFlags,&lpSession);

HrMAPIFindDefaultMsgStore(lpSession, &cbDefStoreEid, &pDefStoreEid);

lpSession->OpenMsgStore(0, cbDefStoreEid, pDefStoreEid, NULL, MAPI_BEST_ACCESS,&lpMDB);

What may be wrong?

Friday, July 24, 2009 3:33 AM by Cash

# re: MAPI and Exchange 2007

You should confirm gcreconnect works - there may be a problem with your environment.

Friday, July 24, 2009 8:55 AM by Stephen Griffin

# re: MAPI and Exchange 2007

I couldn't find directly related topic, so i'm asking under this topic (cause it may be an Exchange 2007 issue);

I set a latest delivery time for a message to get a non delivery report after a given time via PR_LATEST_DELIVERY_TIME (10 minutes i.e.). However, NDR arrives after the time which the "maximum expiry time" settings of MS Exchange 2007 indicates (1 day by default) even though i set PR_LATEST_DELIVERY_TIME. Isn't  it possible to set the latest delivery time using MAPI on Exchange 2007? I used to use this property on Exchange 2003.

Monday, October 12, 2009 1:35 AM by tdl

# re: MAPI and Exchange 2007

How does one set the PKI certificate info, in case the email is S/MIME encoded? Is PR_CONNECT_FLAG control this?

Tuesday, November 17, 2009 9:59 PM by venkat

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker