• Sign in
 
  •  
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...

  • Blog Home
  • About
  • Email Blog Author
  • Share this
  • RSS for posts
  • Atom
  • RSS for comments
  • CDO (24)
  • Code Snippet (43)
  • Custom Providers (17)
  • Debugging (7)
  • DevMsgTeam (300)
  • Documentation (108)
  • DST (8)
  • EWS (7)
  • Exchange (108)
  • Gotchas (97)
  • Hotfix (28)
  • MAPI (239)
  • MAPI Download (53)
  • MFCMAPI (101)
  • MSDN (59)
  • Non Dev (11)
  • OOM (17)
  • Outlook (171)
  • Outlook 2007 Auxiliary Reference (45)
  • Outlook Integration API (12)
  • Protocol Docs (20)
  • PST/OST (23)
  • Referrals (8)
  • Vista (12)
  • WrapPST (18)
Links:
  • Download MFCMAPI
  • MFCMAPI on Facebook
  • Troubleshooting Outlook Crashes
  • Office Update Center
  • Developer Messaging Team Blog
This site is provided "AS IS" with no warranties, and confers no rights. Use of included code samples are subject to the terms specified in the Terms of Use.
Archives
  • May 2013 (2)
  • April 2013 (1)
  • March 2013 (2)
  • February 2013 (2)
  • January 2013 (2)
  • December 2012 (4)
  • November 2012 (2)
  • October 2012 (2)
  • September 2012 (1)
  • August 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (3)
  • March 2012 (3)
  • February 2012 (3)
  • January 2012 (1)
  • December 2011 (3)
  • November 2011 (1)
  • October 2011 (3)
  • September 2011 (1)
  • August 2011 (1)
  • July 2011 (4)
  • June 2011 (3)
  • May 2011 (3)
  • April 2011 (3)
  • March 2011 (5)
  • February 2011 (1)
  • January 2011 (2)
  • December 2010 (1)
  • November 2010 (4)
  • October 2010 (1)
  • September 2010 (3)
  • August 2010 (5)
  • July 2010 (3)
  • June 2010 (3)
  • May 2010 (1)
  • April 2010 (3)
  • March 2010 (3)
  • February 2010 (3)
  • January 2010 (2)
  • December 2009 (3)
  • November 2009 (5)
  • October 2009 (4)
  • September 2009 (5)
  • August 2009 (5)
  • July 2009 (11)
  • June 2009 (6)
  • May 2009 (5)
  • April 2009 (3)
  • March 2009 (18)
  • February 2009 (10)
  • January 2009 (3)
  • December 2008 (2)
  • November 2008 (2)
  • October 2008 (5)
  • September 2008 (4)
  • August 2008 (10)
  • July 2008 (6)
  • June 2008 (8)
  • May 2008 (2)
  • April 2008 (4)
  • March 2008 (2)
  • February 2008 (2)
  • January 2008 (5)
  • December 2007 (3)
  • November 2007 (2)
  • October 2007 (3)
  • September 2007 (1)
  • August 2007 (4)
  • July 2007 (5)
  • June 2007 (3)
  • May 2007 (4)
  • April 2007 (1)
  • March 2007 (6)
  • February 2007 (3)
  • January 2007 (2)
  • December 2006 (4)
  • November 2006 (3)
  • October 2006 (1)
  • August 2006 (1)
  • June 2006 (5)
  • May 2006 (5)
  • December 2005 (1)
  • November 2005 (4)
  • October 2005 (2)
  • September 2005 (1)
  • April 2005 (3)
  • December 2004 (2)
  • September 2004 (2)
  • August 2004 (3)
  • July 2004 (3)

Outlook 2007, Public Folders, MAPI and You

MSDN Blogs > SGriffin's MAPI Internals > Outlook 2007, Public Folders, MAPI and You

Outlook 2007, Public Folders, MAPI and You

Stephen Griffin - MSFT
30 May 2007 1:17 PM
  • Comments 8

This was discussed a while back in one of the newsgroups. I figured I'd document it a little more permanently here.

Outlook 2007's version of the Exchange provider, emsmdb32, doesn't automatically add the Public Folder store to the message store table of a new profile. Instead, it waits until a successful connection has been made to the Exchange server. If it then detects that the public folders are available, it updates the profile and sends a table notification indicating the availability of Public Folders. This is a change from previous versions of Outlook and from Exchange's version of the provider. We made this change to better support Exchange 2007's Public Folder-less environments.

This mechanism of using a table notification has caused some confusion though. Many have observed that the table doesn't appear to be updated at all, yet if they log off the profile and log back on, Public Folders are now suddenly listed. The problem is that for notifications to be processed, messages have to be pumped, and a lot of console or service based MAPI applications don't pump messages. This is where HrDispatchNotifications comes in.

Most MAPI developers probably aren't familiar with this function, but they should be. It does exactly what it says it's going to do: it makes sure all pending notifications have been dispatched. It does this by grabbing the internal table of pending notifications, then pumping messages until the table is empty. As the documentation for the function notes, you could implement this yourself using PeekMessage and DispatchMessage, but not nearly as efficiently.

Here's the general algorithm for logging on to Public Folders using Outlook 2007's version of MAPI:

  1. Check the message store table for a row with PR_MDB_PROVIDER matching pbExchangeProviderPublicGuid. If you find it, use it.
  2. Else, look for PR_MDB_PROVIDER matching pbExchangeProviderPrimaryUserGuid. (If it's not there, this isn't an Exchange profile at all!) Open this provider. (You can Release it if you're not planning on using it.)
  3. Call HrDispatchNotifications.
  4. Scan the message store table again for pbExchangeProviderPublicGuid. If it's still not there, then this environment doesn't have Public Folders. This is NOT an error, so plan for and handle this case gracefully!
  5. If it is there, open it up.

Exercise for the reader 1: Keeping the above in mind, what happens when you use a dynamic profile in CDO?

Exercise for the reader 2: Suppose you create a dynamic profile with CDO, then before closing, it, you Logon again, using the name of the first profile as the first parameter to the second Logon? Hint: remember that deleted profiles aren't really deleted.

  • 8 Comments
Outlook, MAPI, Gotchas, Public Folders, DevMsgTeam
Comments
  • MItch
    10 Jul 2008 7:39 PM

    You don't want to be failmilar with this topic... it's a glitchy as h** don't use it if you send a file attachment and the email takes more than a minnute to send it will loop and contune to send the email hundreds of times and if you use hotmail you will get blocked out of you're own account. So please spare us people some pain and just use something that works, without SEVERE PROBLEMS.

  • Stephen Griffin - MSFT
    10 Jul 2008 9:57 PM

    I give - I don't see what your comment has to do with this post. If you're having issues with Exchange, you can take them to a forum more likely to provide assistance with Exchange administration, like the Ehlo blog: http://msexchangeteam.com/ or, even better, an Exchange newsgroup such as microsoft.public.exchange.admin.

  • Frank Carius
    30 Sep 2008 12:42 PM

    Hello, thanks for that posting, because it describes exacly my problem :-) i use CDO and VBScript to access public folders and checked the infostore instances to find the public folder root. with Outlook 2007 CDO or on a Exchange 2007 Server (with Exchange Server CDO installed), i can only see the "Mailbox".

    Unfortunaly i'm not sure, if i can call "HrDispatchNotifications" from VBScript.

    Any idea to access the PF with CDO and VBScript ? or is thit the last signal to switch to webservices ? (which are not availible with Exchange 2003 and older).

    So any hint how to do the "Step 3, call HrDispatchNotifications" from VBScript ?.

    Frank

  • Stephen Griffin - MSFT
    30 Sep 2008 1:32 PM

    I think you'll need to implement it yourself - so the question comes down to how to implement a message pump in vbscript. I won't be much help there. :)

  • ppeleshok
    22 Oct 2008 2:13 PM

    Hello, thanks for the post. I was just wondering, is the algorithm you prescribe Outlook MAPI specific or is a good idea in general? Should I be using this algorithm for Exchange MAPI as well?

    I'm having a somewhat different issue where I get the E_FAIL instead of the EDK_E_NOT_FOUND so I'm guessing something else is the problem, but I'm thinking this algorithm would be a good prevention to add to my app anyhow. Thoughts? Thanks.

  • Stephen Griffin - MSFT
    22 Oct 2008 2:21 PM

    I don't think this applies to Exchange's version of MAPI. The function's still there, but I think Exchange adds the PF every time, like Outlook used to do.

  • Brijs
    13 Nov 2009 5:48 PM

    We are able to work around the issue by implementing “Exercise for the reader 2” as mentioned in the above blog. But it’s bit ambiguous as we need not to use profile name but use third parameter as “False” so it uses the current shared MAPI session.

    objSession2.LogOn , "", False, False, , True, SERVER  & Chr(10) & Mailbox

    For detail have look @http://blogs.msdn.com/brijs/archive/2009/11/13/issue-accessing-public-folder-store-using-cdo-1-2-1-for-outlook-2007.aspx

  • Shaileshr
    8 Dec 2009 4:18 PM

    @brijs

    The only problem with logging onto a session by specifying "False" as the third paramerter is that it needs the Outlook to be opened. If the Outlook is not running you will still not be able to access the public folder.

Page 1 of 1 (8 items)
Leave a Comment
  • Please add 5 and 2 and type the answer here:
  • Post
  • © 2013 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy & Cookies
  • Report Abuse
  • 5.6.426.415