I am trying to add a date field to mail items. The .NET (C#) code I am using is below:

void UpdateFileDate()

modifyItemRequest mir = new modifyItemRequest();
modifyItemResponse miresp;
ItemChanges updates = new ItemChanges();
Mail newMail = new Mail();

//create the new item that contains the changes
newMail.customs = new Custom[1];
newMail.customs[0] = new Custom();
newMail.customs[0].field = "Export Date";
newMail.customs[0].type = CustomType.Date;
newMail.customs[0].value = DateTime.Now.ToString("MM/dd/yyyy hh:mm");

// assign the new item to the ItemChanges collection
updates.add = newMail;

// configure the modifyItemRequest();

// variable msg is a class member of type BoxEntry
mir.id = this.msg.id;
mir.updates = updates;

// do the thing.
miresp = gw.modifyItemRequest(mir);


I understand that field definitions are added if needed when a field is added to an item.

In this case, I already have a field definition, created by a different application (via the Object API). The field name is "Export Date", and the type is egwDate.

As you can see in the code, above, I am adding a new custom field to a BoxEntry item.

I create the custom field object, and set its type to CustomType.Date.

However, when I execute the modifyItemRequest() method, it creates another field named "Export Date" with type egwString. The string I set as the value is added to THAT field.

Am I doing something wrong? How can I add an egwDate field value? Or should I bag numbers, dates, and binary data, and use only strings? (Which, if true, raises the question "what is the point of allowing me to set a custom field type if everything has to be strings anyway?")