Hello all, hoping I can get some assistance from anyone who's encountered this issue.
I am using EWS/VB.NET and a restriction to search for emails within a specific date range. When the locale is set to "English (US)" the code works just fine. When I move the application to a machine with a locale set to "English (UK)" the FindItem call fails with the error: "Object reference not set to an instance of an object".
I am using a DateTimePicker control, and pass the value to a variable. Then, in my code which builds the request I convert this Date/Time value to a UTC formatted string:
' Add the search criteria
Dim StartDateReceivedField As New PathToUnindexedFieldType()
StartDateReceivedField.FieldURI = UnindexedFieldURIType.itemDateTimeReceived
Dim StartDateReceivedToGet As New ConstantValueType()
StartDateReceivedToGet.Value = EndDate.ToUniversalTime().ToString()
Again, this works
flawlessly on systems set for "English (US)". The main difference here is that in the US the format is MM/DD/YYYY, whereas in the UK it's DD/MM/YYYY. Wouldn't the "ToUniversalTime()" .NET function convert this correctly?
Any help here would be appreciated.
Thank you in advance,
Chris