Question

I write client application that uses Exchange Web Services Proxy Classes in order to connect to Exchange Web Services. Sometimes, I need create ItemType object and make it looks like as received letter. Therefore I need set up such properties of ItemType as DateTimeSent, DateTimeCreate, DateTimeReceived, but they haven’t public set assessTherefore I need set up such properties of ItemType as DateTimeSent, DateTimeCreate, DateTimeReceived, but they haven’t public set assessor.

I found resolve for some of them via MAPI properties:

ItemType newItem = xmlParser.LoadItem(); //info for newItem takes from xml
    newItem.ExtendedProperty = new ExtendedPropertyType[1];
    PathToExtendedFieldType q = new PathToExtendedFieldType();
    q.PropertyTag = "3590"; //DeliveryTime
    q.PropertyType = MapiPropertyTypeType.SystemTime;
    newItem.ExtendedProperty[0] = new ExtendedPropertyType();
    newItem.ExtendedProperty[0].ExtendedFieldURI = q;
    newItem.ExtendedProperty[0].Item = new System.DateTime(2014, 5, 5, 5, 5, 5).ToString("yyyy-MM-ddTHH:mm:ssZ");

Well, it works for DateTimeSent and DateTimeReceived, but not for DateTimeCreate. ES dont give any errors, but DateTimeCreate doesnt change. I tried to UpdateItem with DateTimeCreate propery, but there was no result (update another properties runs fine).

P.S. MAPI ID for CreationTime: 0x3007.

Can someone help me with this problem?

Was it helpful?

Solution

Create and last modified dates are read-only and cannot be set. The store provider updates these properties internally.

OTHER TIPS

I finally found a solution for this.

Source: https://social.msdn.microsoft.com/Forums/en-US/40a29c69-96d3-488b-8f0e-911dd5f04086/setting-a-emailmessage-datetimesent-and-isdraft?forum=exchangesvrdevelopment

You have to set 3 Extended MAPI properties PR_MESSAGE_FLAGS, PR_MESSAGE_DELIVERY_TIME, and PR_CLIENT_SUBMIT_TIME. Make sure when setting the Time you use UTC time.

For example:

        EmailMessage emUploadEmail = new EmailMessage(service);
        emUploadEmail.MimeContent = new MimeContent("us-ascii", bdBinaryData1);
        //  PR_CLIENT_SUBMIT_TIME
        emUploadEmail.SetExtendedProperty(new ExtendedPropertyDefinition(57,MapiPropertyType.SystemTime), DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"));
        // PR_MESSAGE_DELIVERY_TIME 
        emUploadEmail.SetExtendedProperty(new ExtendedPropertyDefinition(3590, MapiPropertyType.SystemTime), DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"));
        //  PR_MESSAGE_FLAGS
        emUploadEmail.SetExtendedProperty(new ExtendedPropertyDefinition(3591,MapiPropertyType.Integer),"1");
        emUploadEmail.Save(WellKnownFolderName.Inbox);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top