728x90
반응형
728x170
▶ CustomAddIn.cs
using Microsoft.Office.Interop.Outlook;
using System;
using System.Text;
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)
{
SearchFolder();
}
#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 폴더 검색하기 - SearchFolder()
/// <summary>
/// 폴더 검색하기
/// </summary>
private void SearchFolder()
{
Folder folder = (Folder)Application.ActiveExplorer().Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
Items foloderItems = folder.Items;
object folderItem = null;
MailItem mailItem = null;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("The following e-mail messages were found : ");
folderItem = foloderItems.Find("[Subject] > 's' And [Subject] <'u'");
while(folderItem != null)
{
mailItem = folderItem as MailItem;
if(mailItem != null)
{
stringBuilder.AppendLine(mailItem.Subject);
}
folderItem = foloderItems.FindNext();
}
MessageBox.Show(stringBuilder.ToString());
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > Outlook' 카테고리의 다른 글
[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] _Explorer 인터페이스 : CurrentFolder 속성을 사용해 현재 폴더 설정하기 (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 |
[C#/OUTLOOK] _MailItem 인터페이스 : Attachments 속성을 사용해 첨부 파일 저장하기 (0) | 2021.06.16 |
댓글을 달아 주세요