728x90
반응형
728x170
▶ CustomAddIn.cs
using Microsoft.Office.Interop.Outlook;
using System;
using System.Windows.Forms;
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)
{
SetCurrentFolder();
}
#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
#region 현재 폴더 설정하기 - SetCurrentFolder()
/// <summary>
/// 현재 폴더 설정하기
/// </summary>
private void SetCurrentFolder()
{
string folderName = "TestFolder";
Folder inboxFolder = (Folder)Application.ActiveExplorer().Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
try
{
Application.ActiveExplorer().CurrentFolder = inboxFolder.Folders[folderName];
Application.ActiveExplorer().CurrentFolder.Display();
}
catch
{
MessageBox.Show($"There is no folder named {folderName}.", "Find Folder Name");
}
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > Outlook' 카테고리의 다른 글
[C#/OUTLOOK] Folder 인터페이스 : 전체 폴더 탐색하기 (0) | 2021.06.18 |
---|---|
[C#/OUTLOOK] ApplicationEvents_11_Event 인터페이스 : Quit 이벤트를 사용해 아웃룩 종료시 처리하기 (0) | 2021.06.18 |
[C#/OUTLOOK] _MailItem 인터페이스 : Move 메소드를 사용해 메일 이동시키기 (0) | 2021.06.17 |
[C#/OUTLOOK] _Explorer 인터페이스 : SelectFolder 메소드를 사용해 임시 보관함을 현재 폴더 설정하기 (0) | 2021.06.17 |
[C#/OUTLOOK] MAPIFolder 인터페이스 : WebViewURL/WebViewOn 속성을 사용해 아웃룩 폴더에 웹 페이지 연결하기 (0) | 2021.06.17 |
[C#/OUTLOOK] _Items 인터페이스 : Find/FindNext 메소드를 사용해 특정 폴더 검색하기 (0) | 2021.06.17 |
[C#/OUTLOOK] Folder 인터페이스 : 루트 폴더 구하기 (0) | 2021.06.17 |
[C#/OUTLOOK] _MailItem 인터페이스 : UserProperties 속성을 사용해 사용자 속성 추가하기 (0) | 2021.06.16 |
[C#/OUTLOOK] _Items 인터페이스 : Restrict 메소드를 사용해 받은 편지함에서 읽지 않은 메일 검색하기 (0) | 2021.06.16 |
[C#/OUTLOOK] _MailItem 인터페이스 : Attachments 속성을 사용해 메일 송신시 파일 첨부하기 (0) | 2021.06.16 |
댓글을 달아 주세요