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

  • About
  • Email Blog Author
  • RSS for posts
  • Atom
  • RSS for comments
    • OK
  • 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)
Blogs I Read
  • Exchange

  • Raymond Chen [MSFT]

  • Larry Osterman [MSFT]

  • Peter David

  • Aaron Margosis [MSFT]

  • Jason Johnston [MSFT]

  • Matt Stehle (MSFT)

  • Patrick Creehan [MSFT]

  • Ryan Gregg [MSFT]

    Outlook PM
  • WebDav 101

    Dan Bagley (MSFT)
  • Dave Vespa [MSFT]

  • Randy Topken

    Outlook EE

August, 2007

MSDN Blogs > SGriffin's MAPI Internals > August, 2007
  • Subscribe via RSS
Sort by: Most Recent | Most Views | Most Comments
Excerpt View | Full Post View
  • SGriffin's MAPI Internals

    MFCMAPI Source is Live

    Posted over 6 years ago
    by Stephen Griffin - MSFT
    • 4 Comments

    I said I'd do it, and now I did it. Introducing the MFCMAPI project on CodePlex: http://www.codeplex.com/MFCMAPI

    Please download the source and inundate me with comments, bugs, and feature requests. There's an issue tracker tab on the CodePlex site that we can use to track bugs, as well as a discussions tab for, well, um, discussions.

    Note that while I'm the only developer on the project, anyone can write an add-in now. I tried to make the add-in model as simple as possible. See the wiki page for a header file, a sample add-in, and docs. Lemme know what kinds of add-ins you dream up.

    I want to thank everyone for being patient while I worked out the details of getting this source published. I hope you find the source instructive.

  • SGriffin's MAPI Internals

    Rebase This: Introducing the Calendar Rebasing Library

    Posted over 6 years ago
    by Stephen Griffin - MSFT
    • 0 Comments

    [This is now documented here: http://msdn2.microsoft.com/en-us/library/bb820976.aspx] 

    We're getting near DST time again. Last time around, we had both an Outlook based tool and an Exchange based tool for rebasing appointments. The idea was the Outlook based tool could be used by end users to update their calendars, while the Exchange based tool could be used by corporate administrators to update their users' calendars en masse.

    For the most part, this worked well. One problem with the Exchange tool was that it was essentially a wrapper around the Outlook tool. That is, the Exchange tool gathered parameters and passed them to the Outlook tool to do the work. The reason this was a problem was that, in addition to the overhead of starting and stopping an external process, we also had to incur the cost of a MAPI logon and logoff for each mailbox being processed. And as any MAPI developer knows, MAPI logon and logoff is expensive and slow.

    So, this time around, we've split all the code that does the rebasing work into a redistributable DLL, tzmovelib.dll. Both Outlook and Exchange rewrote their tools to use this DLL. For the Outlook tool, the effect is negligible. But for the Exchange tool, this allows us to log on to MAPI just one time and then iterate through all the mailboxes which need to be processed. This should allow the Exchange tool to run significantly faster.

    As an added bonus, we now have an API that third party developers can use to perform the rebasing themselves without potentially corrupting calendars by trying to work directly in MAPI. And I got the honor of writing the documentation and a sample for it. We're putting it up here on my blog for now. MSDN documentation based on this blog entry will come later.

    BTW - This DLL will ship with the updated Outlook and Exchange tools when they're released. We've also produced an MSI that can be included with third party rebasing tools. If you are writing a calendar rebasing tool and would like to use the functionality this DLL provides, drop me a note through the contact link below and I'll send you the installer. Please note that for the DLL to work, it must be installed with it's own installer.

    Update (9/12/07):

    Both Exchange and Outlook have shipped their updated tools.

    Exchange's tool can be found here: http://support.microsoft.com/kb/941018. It uses tzmovelib.dll to do the rebasing.

    Outlook's tool can be found here: http://support.microsoft.com/kb/931667. It does NOT use tzmovelib.dll (this is contrary to what I said above - I misunderstood the developer). It does use the same core logic as the Exchange tool though - it's just linked directly into the binary instead of called through a DLL.

    Resources

      Name Location
    DLL: tzmovelib.dll http://blogs.msdn.com/stephen_griffin/contact.aspx
    Header: tzmovelib.h http://stephengriffin.members.winisp.net/TzMoveLib/tzmovelib.h
    Sample: TzTest http://stephengriffin.members.winisp.net/TzMoveLib/tztest.zip

     

    Documentation

    HrCreateApptRebaser

    The HrCreateApptRebaser function initializes a IOlkApptRebaser object for use in rebasing appointments.

    Quick Info

    Header file: tzmovelib.h
    Implemented by: tzmovelib.dll
    Called by: Client applications
    Pointer type: LPHRCREATEAPPTREBASER
    DLL Entry Point: HrCreateApptRebaser@44

    Syntax

    HRESULT HrCreateApptRebaser( 
        ULONG ulFlags,
        IMAPISession *pSession,
        IMsgStore *pCalendarMsgStore,
        IMAPIFolder *pCalendarFolder,
        LPCWSTR pwszUpdatePrefix,
        const FILETIME *pftInstallDateUTC,
        LONG lExpansionDepth,
        const TZDEFINITION *pTZTo,
        const TZDEFINITION *pTZMissing,
        MAPIERROR **ppError,
        IOlkApptRebaser **ppApptRebase);

    Parameters
    ulFlags [in] Bitmask of flags used to control how rebasing is performed. The following flags can be set:

    REBASE_FLAG_UPDATE_ORGANIZED_MEETINGS
    Items in which the user is the meeting organizer will be rebased. Note that by default this will cause meeting updates to be sent out to all attendees of any meeting being rebased. Combine this flag with either REBASE_FLAG_FORCE_NO_EX_UPDATES or REBASE_FLAG_FORCE_NO_UPDATES to change the behavior of how meeting updates are handled.
    REBASE_FLAG_UPDATE_UNMARKED
    Update items that aren't marked with a time zone. If this flag is specified, the pTZMissing value passed to HrCreateApptRebaser will be used as created-in time zone for all items that do not have time zone data.
    REBASE_FLAG_UPDATE_ONLYRECURRING
    Update only recurring items.
    REBASE_FLAG_NO_UI
    Do not show any UI (prevents the display of any logon dialog boxes when opening the message store).
    REBASE_FLAG_UPDATE_MINIMIZEAPPTS
    Do not rebase items that will only have changes which occur in the past.
    REBASE_FLAG_FORCE_REBASE
    Do not check the organizer for rebasing decisions (enables items in which the user is the attendee to be rebased).
    REBASE_FLAG_FORCE_NO_EX_UPDATES
    Only send updates if the user is the organizer and recipient is non-EX.
    REBASE_FLAG_FORCE_NO_UPDATES
    Never send updates.
    REBASE_FLAG_ONLY_CREATED_PRE_PATCH
    Only rebase single instance items created before the patch was applied.
    REBASE_FLAG_REPORTING_MODE
    Do not actually rebase, just report items that would be rebased.
    REBASE_FLAG_SEND_RESOURCE_UPDATES
    Send meeting updates to resources (attendees explicitly specified on the "Resource" line of a meeting).

     

    pSession [in] Required. Pointer to a MAPI session interface.

    pCalendarMsgStore [in] Required. Pointer to a message store containing items to be rebased.

    pCalendarFolder [in] Require. Pointer to a Calendar folder containing items to be rebased.

    pwszUpdatePrefix [in] Optional. Pointer to a string containing the prefix to be prepended on meeting requests. May be NULL.

    pftInstallDateUTC [in] Optional. Timezone patch install date. Only used if the REBASE_FLAG_ONLY_CREATED_PRE_PATCH flag is set.

    lExpansionDepth [in] Expansion depth when expanding distribution lists to exclude EX recipients. Only used if the REBASE_FLAG_FORCE_NO_EX_UPDATES flag is set.

    pTZTo [in] Required. Pointer to a TZDEFINITION structure describing the time zone to be rebased to.

    pTZMissing [in] Required. Pointer to a TZDEFINITION structure describing the time zone to be assumed if time zone information is not stamped on an item. Must not be NULL, but only used if the REBASE_FLAG_UPDATE_UNMARKED flag is set.

    ppError [out] Optional. Pointer to a pointer to a MAPIERROR structure containing version, component, and context information for the error. Can be NULL if no extended error information is desired. Free with MAPIFreeBuffer.

    ppApptRebase [out] Pointer to a pointer to the returned IOlkApptRebaser interface.

    Remarks

    Obtain this function from tzmovelib.dll by calling GetProcAddress with the function name HrCreateApptRebaser@44.

    Not all of the flags are valid in combination with each other. View the "Glossary of command-line options for the Outlook Time Zone Data Update tool" section of http://support.microsoft.com/kb/933146 for more information on the various options.

     

    IOlkApptRebaser : IUnknown

    The IOlkApptRebaser interface is used to rebase appointments in a calendar folder.

    Header file: tzmovelib.h
    Exposed by: Outlook rebasing object
    Implemented by: tzmovelib.dll
    Called by: Client applications

    Vtable Order

    BeginEnumerateAppointments Begins appointment enumeration.
    EndEnumerateAppointments Retrieves results of appointment enumeration and returns a list of appointments needing rebasing.
    BeginRebaseAppointments Begins appointment rebasing. Takes a list of appointments, usually obtained from EndEnumerateAppointments.
    EndRebaseAppointments Retrieves results of appointment rebasing.

     

    IOlkApptRebaser::BeginEnumerateAppointments

    The IOlkApptRebaser::BeginEnumerateAppointments method begins a task for appointment enumeration. This task runs on a new thread.

    Syntax

    HRESULT BeginEnumerateAppointments(
        PFNREBASETASKPROGRESS pfnProgress,
        void **ppContext);

    Parameters

    pfnProgress [in] Optional. Pointer to a rebase task progress function to receive progress.

    ppContext [out] Required. Pointer to a pointer to the returned context. This context will be passed to EndEnumerateAppointments.

     

    IOlkApptRebaser::EndEnumerateAppointments

    The IOlkApptRebaser::EndEnumerateAppointments method waits for appointment enumeration to complete and retrieves the results.

    Syntax

    HRESULT EndEnumerateAppointments(
        void *pContext,
        HRESULT *phResult,
        MAPIERROR **ppError,
        SRowSet **ppRows);

    Parameters

    pContext [in] Required. Pointer to the context obtained from a call to BeginEnumerateAppointments.

    phResult [out] Required. Pointer to an HRESULT to retrieve the result of the enumeration operation.

    ppError [out] Optional. Pointer to a pointer to a MAPIERROR structure to retrieve extended error information.

    ppRows [out] Required. Pointer to a pointer to an SRowSet structure describing the appointments which need rebasing. This structure will be passed to BeginRebaseAppointments.

     

    IOlkApptRebaser::BeginRebaseAppointments

    The IOlkApptRebaser::BeginRebaseAppointments method begins a task for appointment rebasing. This task runs on a new thread.

    Syntax

    HRESULT BeginRebaseAppointments(
        const SRowSet *pRows,
        PFNREBASETASKPROGRESS pfnProgress,
        PFNREBASETASKCOMPLETE pfnComplete,
        void **ppContext);

    Parameters

    pRows [in] Required. Pointer to an SRowSet structure describing the appointments which need rebasing. This structure can be obtained from EndEnumerateAppointments.

    pfnProgress [in] Optional. Pointer to a rebase task progress function to receive progress.

    pfnComplete [out] Optional. Pointer to a rebase task completion function to receive notification of rebase completion.

    ppContext [out] Required. Pointer to a pointer to the returned context. This context will be passed to EndRebaseAppointments.

     

    IOlkApptRebaser::EndRebaseAppointments

    The IOlkApptRebaser::EndRebaseAppointments method waits for appointment rebasing to complete and retrieves the results.

    Syntax

    HRESULT EndRebaseAppointments(
        void *pContext,
        HRESULT *phResult);

    Parameters

    pContext [in] Required. Pointer to the context obtained from a call to BeginRebaseAppointments.

    phResult [out] Required. Pointer to an HRESULT to retrieve the result of the rebasing operation.

     

    RebaseTaskProgress

    The RebaseTaskProgress function reports progress for enumeration and rebasing of appointments. Clients using the IOlkApptRebaser interface implement this function to track item processing.

    Quick Info

    Header file: tzmovelib.h
    Implemented by: Client applications
    Called by: Outlook rebasing object
    Pointer type: PFNREBASETASKPROGRESS

    Syntax

    void STDAPICALLTYPE RebaseTaskProgress( 
        ULONG ulMin,
        ULONG ulMax,
        ULONG ulCur,
        REBASE_APPT_STATE State,
        const SRow* pRowCur);

    Parameters
    ulMin [in] The low end of the range of appointments being processed. Will usually be zero.

    ulMax [in] The high end of the range of appointments being processed. Will usually be the number of items in the calendar folder being processed.

    ulCur [in] The current item being processed.

    State [in] A value indicating the status of the item being processed. Will be one of the following values:

    REBASE_APPT_STATE_SCANNING_EXAMINING - Scanning, examining an item.
    REBASE_APPT_STATE_SCANNING_FOUND - Scanning, found an item.
    REBASE_APPT_STATE_BEGIN - Fixing, starting an item.
    REBASE_APPT_STATE_REBASING - Fixing, adjusting an item.
    REBASE_APPT_STATE_SENDING - Fixing, sending a meeting update.
    REBASE_APPT_STATE_DONE - Fixing, done with item.

    pRowCur [in] Pointer to an SRow structure describing the item being scanned or fixed.

     

    RebaseTaskComplete

    The RebaseTaskComplete function reports completion for rebasing of appointments. Clients using the IOlkApptRebaser interface implement this function to track completion of item updates.

    Quick Info

    Header file: tzmovelib.h
    Implemented by: Client applications
    Called by: Outlook rebasing object
    Pointer type: PFNREBASETASKCOMPLETE

    Syntax

    void STDAPICALLTYPE RebaseTaskComplete( 
        ULONG ulRowIndex,
        const SRow* pRowCur,
        HRESULT hrResult,
        BOOL fModified,
        BOOL fSentUpdate,
        const MAPIERROR* pError);

    Parameters
    ulRowIndex [in] The row which was processed. This index refers to the SRowSet structure passed to BeginRebaseAppointments.

    pRowCur [in] Pointer to an SRow structure describing the item which was processed.

    hrResult [in] An HRESULT indicating the result of the rebasing operation.

    fModified [in] A boolean indicating whether the item was modified.

    fSentUpdate [in] A boolean indicating whether a meeting update message was sent.

    pError [in] Pointer to a MAPIERROR structure with extended error information.

     

    Update: 8-20-07 - Reworded section about redistributable package. Added remark about combining flags.

    Update: 11-02-07 - The redistributable package will be available soon on the MSDN, so don't contact me about obtaining it. Instead, consult the link at the top of this article.

  • SGriffin's MAPI Internals

    Simple MAPI and Vista

    Posted over 6 years ago
    by Stephen Griffin - MSFT
    • 14 Comments

    It's just a day of cool fixes. For months now, people have been bugging me about the fact that MAPIFindNext doesn't work in Vista. I knew we had a fix in the works, but I wasn't able to give any more details than that.

    Well, the wait is over - this issue has been fixed: http://support.microsoft.com/kb/939718.

    Those who look closely at the fix will notice that the file getting the fix is rpcrt4.dll, not in MAPI. What had happened was portions of the code for marshalling parameters across process boundaries was rewritten in Vista. In doing this rewriting, a very obscure corner case was handled improperly, causing the marshalling to fail. The Windows Mail implementation of MAPIFindNext just happened to reliably hit that corner case.

    The fix of course was to make sure that case was handled, and now Simple MAPI works in Vista. Enjoy!

  • SGriffin's MAPI Internals

    Making The New CDO Work With The Old Exchange

    Posted over 6 years ago
    by Stephen Griffin - MSFT
    • 3 Comments

    I know a number of you have asked about this - the latest CDO downloads didn't work with older versions of Exchange because they're passing a flag that allows them to work with Exchange 2007. I alluded to this problem (without actually calling it out) in my post about CONNECT_IGNORE_NO_PF.

    Meanwhile, Jeff has been working on getting this fixed. It's done now. Jeff has a great post on the fix he pushed through for the CDO downloads to allow them to work with older Exchange servers and still be able to deal with Public Folder-less Exchange 2007 servers.

    So here's my take on this. Only set the "Ignore No PF" flag to 1 if you know you're dealing with just Exchange 2007, or if you can somehow guarantee that any Exchange 2003 servers have been patched. Otherwise leave it alone.

    If you're in a mixed server environment (probably the case for most shops running Exchange 2007 right now) then you have to have Public Folders, so not setting the flag is the right thing to do.

    I haven't tested it yet, but I believe the get-PublicFolderDatabase cmdlet can be used to determine if you have any public folders in an Exchange 2007 environment.

Page 1 of 1 (4 items)
  • © 2013 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy & Cookies
  • Report Abuse
  • 5.6.426.415