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

  • About
  • Email Blog Author
  • RSS for posts
  • Atom
  • RSS for comments
    • OK
  • CDO (25)
  • Code Snippet (43)
  • Custom Providers (17)
  • Debugging (7)
  • DevMsgTeam (301)
  • Documentation (109)
  • DST (8)
  • EWS (7)
  • Exchange (109)
  • Gotchas (97)
  • Hotfix (28)
  • MAPI (240)
  • MAPI Download (54)
  • 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 (3)
  • 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

November, 2005

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

    New Outlook Documentation Part 4 - IMAP Headers

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

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

    [This information also published as http://support.microsoft.com/kb/912238]

    Just like Cached mode has a way of accessing items in the OST without triggering a download, our IMAP provider has a mechanism for accessing items in the PST without triggering the download. In an ideal world, they'd both use the same mechanism, but nobody's perfect.

    Topic
    A mechanism to manage messages in an IMAP store.

    IID_IProxyStoreObject
    In an IMAP profile, messages in the PST can be in one of two states

    • A message in its entirety with the header and body
    • A message with only its header downloaded.

    Query for this interface to access a function, UnwrapNoRef, which unwraps the IMAP store and allows access to the underlying PST. Without unwrapping, access of a message in the IMAP store can force a synchronization that will attempt to download the entire message. Using the unwrapped store allows access to the message in its current state without triggering this download.

    The IMsgStore interface returned by UnwrapNoRef is identical in use to the IMsgStore that was unwrapped. The only difference is that the unwrapped store will return messages as they exist in the PST, without forcing synchronization.

    If QueryInterface returns the error MAPI_E_INTERFACE_NOT_SUPPORTED, then the store was not wrapped.

    Definition

    #define DEFINE_PRXGUID(_name, _l) \
    DEFINE_GUID(_name, (0x29F3AB10 + _l), 0x554D, 0x11D0, 0xA9, \
       0x7C, 0x00, 0xA0, 0xC9, 0x11, 0xF5, 0x0A)
    
    DEFINE_PRXGUID(IID_IProxyStoreObject, 0x00000000L);
    
    #define MAPI_IPROXYSTOREOBJECT_METHODS(IPURE) \
    MAPIMETHOD(PlaceHolder1) () IPURE; \
    MAPIMETHOD(UnwrapNoRef) (LPVOID *ppvObject) IPURE; \
    MAPIMETHOD(PlaceHolder2) () IPURE;
    
    DECLARE_MAPI_INTERFACE_(IProxyStoreObject, IUnknown)
    {
       BEGIN_INTERFACE
       MAPI_IUNKNOWN_METHODS(PURE)
       MAPI_IPROXYSTOREOBJECT_METHODS(PURE)
    };

    Usage
    Call QueryInterface on the source message store to obtain the IProxyStoreObject interface. Then call UnwrapNoRef to obtain the unwrapped store. Note that UnwrapNoRef does not addref the returned pointer.

    HRESULT HrUnWrapMDB(LPMDB lpMDBIn, LPMDB* lppMDBOut)
    {
       HRESULT hRes = S_OK;
       IProxyStoreObject* lpProxyObj = NULL;
       LPMDB lpUnwrappedMDB = NULL;
       hRes = lpMDBIn->QueryInterface(IID_IProxyStoreObject,(void**)&lpProxyObj);
       if (SUCCEEDED(hRes) && lpProxyObj)
       {
          hRes = lpProxyObj->UnwrapNoRef((LPVOID*)&lpUnwrappedMDB);
          if (SUCCEEDED(hRes) && lpUnwrappedMDB)
          {
             // UnwrapNoRef doesn't addref, so we do it here:
             lpUnwrappedMDB->AddRef();
             (*lppMDBOut) = lpUnwrappedMDB;
          }
       }
       if (lpProxyObj) lpProxyObj->Release();
       return hRes;
    }
    [Update: Added KB link]
  • SGriffin's MAPI Internals

    New Outlook Documentation Part 3 - Detecting Header Items

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

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

    [This information was also published as http://support.microsoft.com/kb/912239]

    This one jumped ahead in the line because Oliver Seaman was asking me about detecting which items are headers. Next post should be about dealing with IMAP header messages.

    Topic
    A property to identify items in header only state

    dispidHeaderItem
    Both Cached Exchange mode and IMAP support the concept of header items. Messages in the Cached Exchange OST and in the IMAP PST can be in one of two states: a message in its entirety with the header and body, or a message with only its header downloaded.

    This property can be used to determine the current state of a message.

    Note: this property does not apply to remote transport headers, which can be distinguished by the message class “IPM.Remote”.

    Definitions

    #define dispidHeaderItem 0x8578
    DEFINE_OLEGUID(PSETID_Common, MAKELONG(0x2000+(8),0x0006),0,0);
    

    Usage
    This is a named property of type PT_LONG which will be present and non-zero on a message if the message is a header.

    BOOL bIsHeader(LPMESSAGE lpMessage)
    {
    	HRESULT         hRes = S_OK;
    	BOOL            bRet = false;
    	ULONG           ulVal = 0;
    	LPSPropValue    lpPropVal = NULL;
    	LPSPropTagArray lpNamedPropTag = NULL;
    	MAPINAMEID      NamedID = {0};
    	LPMAPINAMEID    lpNamedID = NULL;
    
    	NamedID.lpguid = (LPGUID) &PSETID_Common;
    	NamedID.ulKind = MNID_ID;
    	NamedID.Kind.lID = dispidHeaderItem;
    	lpNamedID = &NamedID;
    
    	hRes = lpMessage->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
    
    	if (lpNamedPropTag && 1 == lpNamedPropTag->cValues)
    	{
    		lpNamedPropTag->aulPropTag[0] = CHANGE_PROP_TYPE(lpNamedPropTag->aulPropTag[0], PT_LONG);
    
    		//Get the value of the property.
    		hRes = lpMessage->GetProps(lpNamedPropTag, 0, &ulVal, &lpPropVal);
    		if (lpPropVal && 1 == ulVal && PT_LONG == PROP_TYPE(lpPropVal->ulPropTag) && lpPropVal->Value.ul)
    		{
    			bRet = true;
    		}
    	}
    	
    	MAPIFreeBuffer(lpPropVal);
    	MAPIFreeBuffer(lpNamedPropTag);
    	return bRet;
    }
    
    [Update: Added KB link]
  • SGriffin's MAPI Internals

    Offline State Sample

    Posted over 8 years ago
    by Stephen Griffin - MSFT
    • 1 Comments

    There have been questions lately on the MAPI mailing list about how to get the connection state API working. Particularly the HrOpenOfflineObj and Advise calls. Since I had a partial sample already sitting here I figured I whip it into shape and publish it.

    I'll refer most questions of implementation to the sample code itself. One thing does need to be called out though: This API only works in process. The only intended clients of this API are MAPI providers, COM Add-Ins, and Exchange Client Extensions. If your code is not running inside Outlook.exe, expect HrOpenOfflineObj to return MAPI_E_NOT_FOUND. This point is not made clear in the published documentation.

    I've implemented this sample as a Com Add-In. When loaded, an "Offline State" menu will appear. Through this menu, you can enable/disable state monitoring, check the current state, and change the current state. A lot of the output for the sample is through OutputDebugString, so run under the debugger or use a debug monitor to watch it. It also writes a log file to c:\offstate.txt.

    The sample should compile in VC6 or VS 2003. I haven't tested it with VS 2005 yet, but it ought to work there as well.

    Here's the download link: http://stephengriffin.members.winisp.net/OfflineStateAddIn/OfflineStateAddIn.zip

    Thanks to JasonJoh for writing some of the UI that I didn't feel like writing, and thanks to Shawn Walker for providing the impetus for fixing up and publishing the sample in the first place.

    [11/11/05] Fixed sample URL

  • SGriffin's MAPI Internals

    Your Proxy Server Doesn't Like My Samples

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

    It has come to my attention that the site I was using to store my code samples, http://stephen_griffin.members.winisp.net poses a problem for some users due to the underscore. Apparently some proxy server have problems handling sites with underscores. Sounds like a bug in the proxy server to me, but still I want people to be able to get to the samples.

    So I've moved them all over to http://stephengriffin.members.winisp.net. Note that I've just dropped the underscore from the name. I should have all my articles updated with the new url before the day is over.

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