views:

95

answers:

2

This seems like a no-brainer but I couldn't find anything on it.

How do I detect if a date variant in Outlook is "empty"? For example TaskItem.DueDate - the duedate is not necessarily filled.

If it's not filled Outlook returns "4501.01.01." - I can test for this value, but this just doesn't seem "elegant" enough.

Thanks!

+2  A: 

If that's what it returns when the date isn't filled, then that's probably the simplest way to test for it. If that means your code turns out to be less elegant than it ought to be, (and I agree, it is,) well, that's Microsoft's fault, not yours.

One thing that would make the code look better is to declare 4501.01.01 as a const. Call it EMPTY_DATE or something like that, and then have your code test against EMPTY_DATE instead of against the literal. That way it's obvious what you're checking for when you read the code.

Mason Wheeler
+3  A: 

1/1/4501 is the value Outlook uses for DATE_NONE. Many documents on MSDN refer to this implementation detail.

Remy Lebeau - TeamB