问题
My company is using Exchange 2003.
Is it possible to query exchange from .NET code to find out if someone's 'Out of Office' assisstant is on or off?
回答1:
Using the Outlook Redemption library, you can get Out of Office status like this:
public bool IsOutOfOffice()
{
var outlook = new Microsoft.Office.Interop.Outlook.Application();
var rdoSession = new Redemption.RDOSession();
rdoSession.MAPIOBJECT = outlook.Session.MAPIOBJECT;
Redemption.RDOOutOfOfficeAssistant OOFA =
(_rdoSession.Stores.DefaultStore as Redemption.RDOExchangeMailboxStore).OutOfOfficeAssistant
return OOFA.OutOfOffice;
}
To check another user's status, you need to get the MAPIOBJECT
for their mailbox.
来源:https://stackoverflow.com/questions/1305322/getting-the-outlook-out-of-office-flag-with-net