0

Currently I have a Exchange public folder that has assigned Custom Form. One of the many user defined fields on the form is set to be of Currency. For some reason doesn't matter what I do, I can't set Currency field pragmatically.

I have created a separate folder and simple custom form where one field is of type Currency as below:

Custom Form Setup

Then I am able to create Post Item and save it to the folder that has test custom form assigned but unfortunately I can't seems to set TestCurrency extended property:

   var JobsSearchFilter = 
        new SearchFilter.IsEqualTo(FolderSchema.DisplayName, JobsFolderName);
    var JobsFolder = 
        service.FindFolders(WellKnownFolderName.PublicFoldersRoot, JobsSearchFilter, new FolderView(1)).Single();

    var JobsSearchFilter = 
        new SearchFilter.IsEqualTo(FolderSchema.DisplayName, jobFolderName);
    var ewsFolderUniqueId = 
        JobsFolder.FindFolders(JobsSearchFilter, new FolderView(1)).Single().Id;

    var postItem = new PostItem(service)
    {
        ItemClass = "IPM.Post.EWSTestingForm",
        Subject = "Testing Custom Forms"
    };

    postItem.SetExtendedProperty
        (new ExtendedPropertyDefinition
            (DefaultExtendedPropertySet.PublicStrings,
            "TestText",
            MapiPropertyType.String), "TestTextValue");
    postItem.SetExtendedProperty
        (new ExtendedPropertyDefinition(
            DefaultExtendedPropertySet.PublicStrings,
            "TestCurrency",
            MapiPropertyType.Currency), 1200.000);
    postItem.Save(ewsFolderUniqueId);

Do Currency extended property fields need special treatments? All other fields seem to work (text, booleans etc)

Interestingly as I investigate more, it turns out that extended property of MapiPropertyType.Currency is being posted to the Exchange Server as I can retrieve it right away but custom form doesn't pick up the value. It appears to be that the reason why it is not picking it up is because EWS creates extended property of type PT_I8 instead of PT_CURRENCY (got those via OutlookSpy). It is likely that it is a bug in EWS for mapping MapiPropertType.Currency to correct Exchange mapi type...

Extended Properties set via EWS vs User Input in Custom Form

Ivan
  • 5
  • 2
  • good research. which numeric value does the MapiPropertyType.Currency have, when you look it up in object browser? does it match [these](https://msdn.microsoft.com/en-us/library/office/cc839705.aspx)? – Cee McSharpface Jan 12 '17 at 21:17
  • it is [suggested here](http://stackoverflow.com/a/25189760/1132334) that for custom properties, a custom set should be used. There seems to be a second way to post custom extended properties, with a GUID instead of the pre-defined `PublicStrings` set. Maybe there is some kind of mismatch this way. – Cee McSharpface Jan 12 '17 at 21:22

0 Answers0