none
Getting to MAPI properties via EWS Managed API RRS feed

  • Question

  • Hi there

    I'm trying to replace our MAPI layer with EWS, so we can target BPOS and a load of situations where MAPI can't work. However, we need access to all the mapi properties. And I mean ALL of them (our product is an email archiver)

    However, it appears that this is not supported by EWS - can anyone confirm this is the case?

    Basically, I want to (and can already) open a mailbox, get a list of folders, and for each folder, get a list of messages and iterate over them. But I can't get MAPI properties - I've tried it using extendedproperties:



    ItemView itemView = new ItemView(1000); // not bothering doing paging yet
    
     ExtendedPropertyDefinition extended =
                            new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common,
                                                           0x1013, MapiPropertyType.String);
                        itemView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, extended);
    
    //itemView.Traversal = ItemTraversal.Associated;
    
     FindItemsResults<Item> items = folder.FindItems(itemView);


    I've tried it with the base service object

    service.LoadPropertiesForItems(items, itemView.PropertySet);

    and a few other ways, but nothing.

    Is this possible to do? I get that most people dont want it, so it's not in there by default, sure surely we could have something like:

    MapiProperties[] props = service.GetMapiPropertyCollection(item.ItemId)

    Thanks!

    Nic
    Tuesday, February 16, 2010 12:01 PM

All replies

  • It looks like 0x1013 (which I think is just the HTML body) is a binary property.  I don't use the managed API myself (I prefer to send plain XML requests), but this looks like th kind of thing you're looking for:

    http://www.infinitec.de/post/2009/06/09/Getting-the-body-of-an-Email-with-a-FindItems-request.aspx
    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    Tuesday, February 16, 2010 1:30 PM
  • Thanks Lee, but that one was just an example. I need them all. Every last one of them. Preferable something like this (pseudo code):

    Get me a folder.

    Folder folder = service.FindFolder(Inbox);

    for each item in the folder: get me the message item

    foreach(var message in folder.Messages) {

    for that message item, get me a list of all MAPI property types which it has

    MapiProperties[] props = message.GetMapiProperties();

    foreach(var prop in props) {
      // do something with the mapi property

    }

    I dont need a specific one - I need all of them. Especially things like PR_ENTRYID and some of the other ones. It's hard to do a compliance-driven email archive if I can't get all the properties!

    Thanks for the help tho :)
    Tuesday, February 16, 2010 1:35 PM
  • Oh, right.  I don't think you'll find anything like that.  There is the AllProperties GetItem shape, of course, but like the old WebDAV ALLPROPS PROPFIND, it doesn't really get /everything/.
    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    Tuesday, February 16, 2010 1:42 PM
  • Hrmm, the managed EWS doesn't appear to have "shapes" - tho I guess I can read it again.

    I've managed to get any property I want, but the only way to find out whats there is to ask for everything, which is going to kill the exchange server. I pretty much need to as (per message): what properties do you have, then give me the values for them.

    Now, I'm sure we asked MSFT for this in a pre-Ex2007 briefing thing.....

    so much for EWS managed etc being a replacement for mapi (at least for 3rd parties to get into exchange)

    Cheers Lee :)
    Tuesday, February 16, 2010 1:53 PM
  • I'm talking about the <ItemShape><BaseShape> here:

    http://msdn.microsoft.com/en-us/library/aa566013.aspx

    I'm sure they'll be in the API somewhere.
    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    Tuesday, February 16, 2010 1:59 PM
  • Tuesday, February 16, 2010 2:06 PM
  • Not from the list of classes I can see:


    I was under the impression that they went out when the old, com-based EWS changed into the managed one?
    Tuesday, February 16, 2010 2:16 PM
  • Thanks - yes, it does, however as I said above - I can request any property I like (thanks to trawling thru the ewseditor code), but I can't ask for a list of valid ones from the server. So, I could ask for all 65000 property types (16 bit number), but if I have only 20 of them set, its kinda pointless (not to mention it crashes and makes exchange very unhappy)

    :(

    Ta for the pointer hto
    Tuesday, February 16, 2010 2:18 PM
  • OK, so I've now worked out that I can definitly get any property I like - and EWSEditor does this. But I can't get a list of whats there, I have to just blindly put in all of them, or put in known ones, watch for exceptions if anything is wrong, remove the broken ones, try again.... etc.

    Known ones isn't much use if the customer has some app which adds custom ones. Or if the known list changes.
     

    Really, I think thats a bit of a fail. Anyone from MSFT care to comment (or better yet, tell me I'm an id10t and not looking in the right place)??
    Tuesday, February 16, 2010 2:49 PM
  • There is indeed no way to find out which properties are available on an item with EWS. This is a limitation we are aware of, but although I realize it may be important to you it is unfortunately relatively low on our todo list compared to other features. It definitely is on the todo list though, and will be considered in a future release.


    David Claux | Program Manager - Exchange Web Services
    Tuesday, February 16, 2010 4:24 PM
  • Thanks David - thats the general conclusion I've come to (via various sources - thanks everyone) Pity - I'd love to get rid of MAPI in this case.... not to mention support BPOS and hosted exchange.
    Tuesday, February 16, 2010 6:46 PM
  • Hi David,

    we have the same requirement.

    This is a basic feature of MAPI which is essential for us, too. So if we should switch from MAPI to EWS this is a "must have" for the EWS.

    I recognized other flaws in EWS: The MIME content of an an attached message is not accessible, in managed EWS this is always NULL.

    Do you have an idea how create a (MAPI free) workaround for this?

    Regards

    Thorsten

    Friday, July 23, 2010 1:34 PM