Getting the Outlook Out of Office flag with .NET

泄露秘密 提交于 2019-12-05 05:56:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!