none
Folder Extended Properties (EWS+Outlook) RRS feed

  • Question

  • What Im trying to achive is to be able to create a Folder with Extended Properties using EWS and then be able to read these properties from inside Outlook.

    Ive verified that it works to add & retrieve extended properties on Folders using EWS, i.e.

           

            var f = new Folder(_svc);
    f.DisplayName = "Testing";
            f.SetExtendedProperty(EPD.ItqAction, 1);
            f.Save(WellKnownFolderName.MsgFolderRoot);

    then loading it as following,

            PropertySet propset = new PropertySet(PropertySet.IdOnly);
            propset.Add(EPD.ItqAction);
            f.Load(propset);

    or even using SearchFilder.IsEqual()

    but these Properties does not appear in OutlookSpy nor MFCAPI, and can't seem to be accessable from Outlook VSTO.

    I've tried 

    myFolder.PropertyAccessor.GetProperty(EPD.ItAction.ToMapiString());

    ToMapiString creates a "http://schemas.microsoft.com/mapi/{GUID}/attr-name" string

    But this results in a COMException. 

    Ive heard that named Properties are not supported by Outlook, what is the alternative type definition? And that one should create a Hidden Item in the folder for properties. But haven't been able to find any details on how to create a hidden item (only Hidden folders w/ attribute 0x10f4).


    Monday, March 9, 2015 6:11 PM

Answers

  • Solved it by creating an Associated Item manually, that is 

    var itm = new EmailMessage(svc);
    itm.ItemClass = Data.ClassName;
    itm.IsAssociated = true; 

    then adding all properties to this item, and saving it to the Folder.



    Tuesday, March 10, 2015 10:17 AM

All replies

  • What is the value of EPD.ItqAction?

    On the client side, are you using cached or an online profile?

    Keep in mind that Exchange folders do not support named properties. You'd need to use hidden (associated) messages in the folder to store your custom data.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, March 9, 2015 6:31 PM
  • Daniel,

    It looks like the custom property was vanished in Outlook. Custom properties are visible in a low-level property viewer such as MFCMAPI or OutlookSpy.

    Typically user defined properties are vanished if they are not defined in the delivery store. Only properties that are defined on the inbox folder are preserved.

    Anyway, I'd recommend asking EWS specific questions on the Exchange dev forums instead.

    Monday, March 9, 2015 6:31 PM
  • EPD.ItqAction is a ExtendedPropertyDefinition, definied as following,

      public static class EPD {
        static readonly Guid PropertyGroupId = new Guid("{xxx}");

    ....

        public static readonly ExtendedPropertyDefinition ItqAction = new ExtendedPropertyDefinition(PropertyGroupId, "itq_action", MapiPropertyType.Integer);

    ... 

    }

    It's a Online Profile (Freshly updated) working against Exchange Online.

    Any resource pointer to how to create/manage hidden/associated messages using EWS? (Googling "ews associated OR hidden messages" didn't do much good)


    Monday, March 9, 2015 6:44 PM
  • The forum is for Outlook related dev questions. Ask EWS specific questions on the Exchange Server Development forum instead.
    Monday, March 9, 2015 7:46 PM
  • Yep, named properties (guid + int or string) are not supported by Exchange folders. I am surprised you are not getting an error when you set it.

    Is using hidden messages an option?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, March 10, 2015 1:44 AM
  • >user defined properties are vanished if they are not defined in the delivery store".

    What exactly do you mean? How is that possible?

    >I'd recommend asking EWS specific questions on the Exchange dev forums instead

    Eugene, I am answering this question in the Outlook dev forum. It is perfectly fine here. If you do not know how to answer it, you do not have to reply. There is no requirement that you answer each and every question asked in the forum.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, March 10, 2015 2:53 AM
  • In the EWS doco hidden items are refereed to as FAI (Folder associated Items) https://msdn.microsoft.com/en-us/library/office/dn508269%28v=exchg.150%29.aspx you need to be using exchange 2010 or above to access the Associated (hidden) Items collection of a folder. In the Managed API you can do this using the UserConfiguration Class eg

                UserConfiguration usrConfig = new UserConfiguration(service);
                usrConfig.Dictionary.Add("BlahBlah", "Value");
    
                Folder newFolder = new Folder(service);
                newFolder.DisplayName = "BlahBlah";
                newFolder.FolderClass = "IPF.Note";
                newFolder.Save(WellKnownFolderName.Inbox);
                usrConfig.Save("CustomConf", newFolder.Id);
    
                usrConfig = UserConfiguration.Bind(service, "CustomConf", newFolder.Id, UserConfigurationProperties.Dictionary);
                if (usrConfig.Dictionary.ContainsKey("BlahBlah"))
                {
                    Console.WriteLine(usrConfig.Dictionary["BlahBlah"]);
    
                }

    Cheers
    Glen

    Tuesday, March 10, 2015 4:27 AM
  • Solved it by creating an Associated Item manually, that is 

    var itm = new EmailMessage(svc);
    itm.ItemClass = Data.ClassName;
    itm.IsAssociated = true; 

    then adding all properties to this item, and saving it to the Folder.



    Tuesday, March 10, 2015 10:17 AM
  • It is up to you to answer Exchange specific questions or not.

    But I always recommend using the most appropriate forums to post questions and get the qualified feedback (not only yours).

    Tuesday, March 10, 2015 10:26 AM