我为选定的附件创建了一个Outlook插件,以获取附件的详细信息.它在Outlook 2010中运行良好.但是当我为Outlook 2016构建它时,它变为null.
以下是ThisAddIn.cs中的代码: -
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly();
Uri uriCodeBase = new Uri(assemblyInfo.CodeBase);
string Location = Path.GetDirectoryName(uriCodeBase.LocalPath.ToString());
var path = Location.Split(new string[] { "bin" }, StringSplitOptions.RemoveEmptyEntries);
var rootDir = path[0].ToString();
var forPermissionsRootDirectory = Path.GetDirectoryName(rootDir);
SetPermissions(forPermissionsRootDirectory);
app = this.Application;
app.AttachmentContextMenuDisplay += new Outlook.ApplicationEvents_11_AttachmentContextMenuDisplayEventHandler(app_AttachmentContextMenuDisplay);//attach Attachment context Menu Event//
}
void app_AttachmentContextMenuDisplay(Office.CommandBar CommandBar, Outlook.AttachmentSelection selection)
{
selectedAttachment = selection;
RibbonUI.InvalidateControlMso("ContextMenuAttachments");//will get XML file data//
}
Run Code Online (Sandbox Code Playgroud)
这是AttachmentContextMenu.cs中的代码: -
public void OnOpenMyMotionCalendarButtonClick(Office.IRibbonControl control)
{
Outlook.AttachmentSelection selection = …Run Code Online (Sandbox Code Playgroud)