我对插件的东西真的很陌生。我的代码应该执行以下操作: Outlook 用户保存/创建任何内容。如果创建的项目是约会项目,我的系统必须将它保存在 c: 目录下,以项目主题作为文件名。这是我的代码。那里有什么问题?
注意:当我创建一个新约会时,if 子句正在工作,如果我在那里写任何其他代码,它正在工作,但我无法获得 ai 的信息,例如ai.Subject
.
namespace SendToMRBS
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.ItemLoad += new Outlook.ApplicationEvents_11_ItemLoadEventHandler(Application_ItemLoad);
}
void Application_ItemLoad(object Item)
{
if (Item is Outlook.AppointmentItem)
{
Outlook.AppointmentItem ai = Item as Outlook.AppointmentItem;
ai.SaveAs("C:\\" + ai.Subject, Microsoft.Office.Interop.Outlook.OlSaveAsType.olICal);
}
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}