从约会检查器窗口从委派的电子邮件帐户中获取信息-使用addin-express的Outlook 2013 [英] Getting information from delegated email account from appointment inspector window - outlook 2013 using addin-express

查看:195
本文介绍了从约会检查器窗口从委派的电子邮件帐户中获取信息-使用addin-express的Outlook 2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用外接程序开发Outlook插件.有两个邮件帐户(A)已通过委派授予日历对帐户(B)的访问权限.我正在为帐户(B)开发插件.

I am developing an Outlook plugin using add-in-express. There are two mail account (A) which has granted calendar access to account (B) through delegation. I am developing the plugin for account (B).

这就是我要实现的目标.

我使用帐户(B)的凭据(作为用户,而不是C#代码)登录Outlook后,打开了(A)的日历帐户.然后双击日历的某个日期,这将为我打开一个新的检查器窗口. 在检查人员的功能区中,我的插头上有一个按钮.用户单击按钮后,我需要在检查器的正文中显示电子邮件所有者的(帐户(A))电子邮件和姓名.

I open the calendar account of (A) after login to outlook using the credentials of account (B) (as a user, not by C# code). Then double click on some date of the calendar, which leads to open a new inspector window for me. In the ribbon of the inspector, there is a button coming from my pluging. After user click the button, I need to show the email owner’s (account (A)) email and name in the body of the inspector.

这是按钮的代码

    private void adxRibBtnDelegateTest_OnClick(object sender, IRibbonControl control, bool pressed)
    {
        Outlook.Inspector currentInspector = null;
        Outlook.AppointmentItem myAppointment = null;
        Outlook.MailItem myMailItem = null;

        string ownerEmail = string.Empty;
        string ownerName = string.Empty;


        try
        {
            currentInspector = Globals.ObjOutlook.ActiveInspector();
            myAppointment = currentInspector.CurrentItem as Outlook.AppointmentItem;
            myMailItem = currentInspector.CurrentItem as Outlook.MailItem;

            Outlook.AppointmentItem appt = currentInspector.CurrentItem as Outlook.AppointmentItem ;
            Outlook.MAPIFolder parent = appt.Parent as Outlook.MAPIFolder;

            // ToDo:
            // Here I need to develop the functionality for getting the delegated account owner's email and name

            string body = "\n\nOwner's Email\t: " + ownerEmail
                + "\nOwner's Name\t: " + ownerName;

            if (myAppointment != null)
            {
                myAppointment.Body = body;
            }
            else if (myMailItem != null)
            {
                myMailItem.Body = body;
            }

        }
        catch (Exception ex)
        {
            Debug.DebugMessage(2, "Error in AddNewNationalCall() : " + ex.Message);
        }
        finally
        {
            if (myAppointment != null) Marshal.ReleaseComObject(myAppointment);
            if (myMailItem != null) Marshal.ReleaseComObject(myMailItem);
            if (currentInspector != null) Marshal.ReleaseComObject(currentInspector);
            GC.Collect();
        }
    }

您能在这方面给我建议吗?谢谢.

Can you please advise me on this? Thank you.

推荐答案

尝试读取PR_CreatorEmailAddr MAPI属性(DASL名称http://schemas.microsoft.com/mapi/proptag/0x4023001F)或GUID = {11000E07-B51B-40D6-AF21-CAA85EDAB1D0}(PSETID_CalendarAssistant)且ID = 0xA(DALS)的命名属性名称http://schemas.microsoft.com/mapi/id/{11000E07-B51B-40D6-AF21-CAA85EDAB1D0}/000A001F)使用AppointmentItem.PropertyAccessor.GetProperty.

Try to read the PR_CreatorEmailAddr MAPI property (DASL name http://schemas.microsoft.com/mapi/proptag/0x4023001F) or a named property with GUID = {11000E07-B51B-40D6-AF21-CAA85EDAB1D0} (PSETID_CalendarAssistant) and ID = 0xA (DALS name http://schemas.microsoft.com/mapi/id/{11000E07-B51B-40D6-AF21-CAA85EDAB1D0}/000A001F) using AppointmentItem.PropertyAccessor.GetProperty.

确切可用的内容取决于Exchange,Outlook的版本以及是否缓存了委托文件夹.使用 OutlookSpy (单击IMessage)查看其中一个文件夹中的约会,以查看可用的约会.

What exactly will be available depends on the version of Exchange, Outlook, and on whether the delegate folders are cached. Take a look at an appointment in one of those folders with OutlookSpy (click IMessage) to see what is available.

这篇关于从约会检查器窗口从委派的电子邮件帐户中获取信息-使用addin-express的Outlook 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆