开发者

Delphi and Outlook TaskItem: How to know if DueDate is empty?

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 开发者_JS百科not filled Outlook returns "4501.01.01." - I can test for this value, but this just doesn't seem "elegant" enough.

Thanks!


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜