获取Outlook的起始文件夹-VSTO

 实现环境:Visual Studio 2010 Uiltmate, Office 2010

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using System.Windows.Forms;

namespace OutlookAddIn11
{
    public partial class ThisAddIn
    {
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            Outlook.Explorer olExplorer = Application.ActiveExplorer();
            Outlook.MAPIFolder olStartFolder = olExplorer.CurrentFolder;
            MessageBox.Show(Application.Session.DefaultStore.DisplayName +"=>"+olStartFolder.Name);
        }

        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
    }
}


 

posted @ 2013-02-28 20:34  许阳 无锡  阅读(274)  评论(0编辑  收藏  举报