简体   繁体   中英

Checking if Outlook ContactItem has Birthday data

I'm retrieving Outlook contacts and would like to find those that have a Birthday defined. When I read a contact that has no Birthday defined, the Birthday property of the ContactItem returns a date in the year 4501, using which I filter the contacts:

if (contact.Birthday.Year != 4501)
{
    ... the contact has a birthday defined, do something ...
}

Naturally I don't feel comfortable with this code. I guess the 4051 relates to some No-Value state either in the DateTime type or in Outlook, however in the DateTime spec I didn't find an "Empty" property or something like that.

Is there another way to know whether an Outlook contact has a Birthday defined?

Thanks

是的.. Outlook中的空日期是对此的#1/1/4501#测试,您会没事的..我知道这很疯狂(下一个Y2K):)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM