1
我要去访问Outlook MAPI文件夹和接收邮件访问邮件对象MAPI address.Here是我的方法无法从调用函数
public static string GetSenderEmailAddress(Microsoft.Office.Interop.Outlook.MailItem mapiObject)
{
Microsoft.Office.Interop.Outlook.PropertyAccessor oPA;
string propName = "http://schemas.microsoft.com/mapi/proptag/0x0065001F";
oPA = mapiObject.PropertyAccessor;
string email = oPA.GetProperty(propName).ToString();
return email;
}
当按钮的单击事件称为,我需要的大火,方法和检索邮件地址。
按钮点击事件在这里。
private void button3_Click(object sender, RibbonControlEventArgs e)
{
string mailadd = ThisAddIn.GetSenderEmailAddress(Microsoft.Office.Interop.Outlook.MailItem);
System.Windows.Forms.MessageBox.Show(mailadd);
}
错误放在这里
Microsoft.Office.Interop.Outlook.MailItem是一个“type'which无效在给定上下文
这是我的第一个插件,有谁知道如何实现这个结果?
你确定的MailItem对象是有效的?它从何而来? –
当我调用按钮单击事件错误happend.It函数来自调用函数 –
好吧,调用者函数从哪里得到它? –