첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.01MB

▶ CustomAddIn.cs

using Microsoft.Office.Interop.Outlook;
using System;
using System.Text;

namespace TestProject
{
    /// <summary>
    /// 커스텀 애드인
    /// </summary>
    public partial class CustomAddIn
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private
        //////////////////////////////////////////////////////////////////////////////// Event

        #region 커스텀 애드인 시작시 처리하기 - CustomAddIn_Startup(sender, e)

        /// <summary>
        /// 커스텀 애드인 시작시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void CustomAddIn_Startup(object sender, EventArgs e)
        {
            MAPIFolder folder = Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

            Table table = folder.GetTable(string.Empty, OlTableContents.olHiddenItems);

            StringBuilder stringBuilder = new StringBuilder();

            while(!table.EndOfTable)
            {
                Row nextRow = table.GetNextRow();

                if(nextRow["Subject"] == null)
                {
                    stringBuilder.AppendLine(nextRow["MessageClass"]);
                }
                else
                {
                    stringBuilder.AppendLine($"{nextRow["Subject"]} : {nextRow["MessageClass"]}");
                }
            }

            System.Windows.Forms.MessageBox.Show(stringBuilder.ToString());
        }

        #endregion
        #region 커스텀 애드인 셧다운시 처리하기 - CustomAddIn_Shutdown(sender, e)

        /// <summary>
        /// 커스텀 애드인 셧다운시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void CustomAddIn_Shutdown(object sender, EventArgs e)
        {
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////// Function

        #region VSTO에서 생성한 코드

        /// <summary>
        /// 디자이너 지원에 필요한 메서드입니다. 
        /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup  += new System.EventHandler(CustomAddIn_Startup );
            this.Shutdown += new System.EventHandler(CustomAddIn_Shutdown);
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요