728x90
반응형
728x170
▶ Folder 인터페이스 : 전체 폴더 경로를 사용해 폴더 구하기 예제
using Microsoft.Office.Interop.Outlook;
Folder folder = GetFolder(Application, @"\\icodebroker@naver.com\받은 편지함");
728x90
▶ Folder 인터페이스 : 전체 폴더 경로를 사용해 폴더 구하기
using Microsoft.Office.Interop.Outlook;
#region 폴더 구하기 - GetFolder(application, fullFolderPath)
/// <summary>
/// 폴더 구하기
/// </summary>
/// <param name="application">애플리케이션</param>
/// <param name="fullFolderPath">전체 폴더 경로</param>
/// <returns>폴더</returns>
public Folder GetFolder(Application application, string fullFolderPath)
{
try
{
if(fullFolderPath.StartsWith(@"\\"))
{
fullFolderPath = fullFolderPath.Remove(0, 2);
}
string[] folderPathItemArray = fullFolderPath.Split('\\');
Folder folder = application.Session.Folders[folderPathItemArray[0]] as Folder;
if(folder != null)
{
for(int i = 1; i <= folderPathItemArray.GetUpperBound(0); i++)
{
Folders folders = folder.Folders;
folder = folders[folderPathItemArray[i]] as Folder;
if(folder == null)
{
return null;
}
}
}
return folder;
}
catch
{
return null;
}
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > Outlook' 카테고리의 다른 글
[C#/OUTLOOK] MAPIFolder 인터페이스 : GetTable 메소드를 사용해 숨겨진 항목 열거하기 (0) | 2022.01.26 |
---|---|
[C#/OUTLOOK] MailItem 인터페이스 : 메일 메시지 헤더 구하기 (0) | 2021.11.16 |
[C#/OUTLOOK] FormRegionBase 클래스 : FormRegionShowing 이벤트를 사용해 폼 영역 표시 여부 설정하기 (0) | 2021.10.27 |
[C#/OUTLOOK] Store 인터페이스 : GetDefaultFolder 메소드를 사용해 디폴트 폴더 구하기 (0) | 2021.10.09 |
[C#/OUTLOOK] Account 인터페이스 : 특정 폴더의 계정 구하기 (0) | 2021.10.07 |
[C#/OUTLOOK] 양식 영역(Form Region) 사용하기 (0) | 2021.10.06 |
[C#/OUTLOOK] 메일 쓰기 창의 메일 본문에서 이벤트 사용하기 (0) | 2021.10.05 |
[C#/OUTLOOK] Inspector 인터페이스 : WordEditor 속성을 사용해 메일 쓰기 창에서 선택 텍스트 구하기 (0) | 2021.10.05 |
[C#/OUTLOOK] Application 인터페이스 : ItemSend 이벤트에서 메일 발송 취소하기 (0) | 2021.10.05 |
[C#/OUTLOOK] Application 인터페이스 : Explorers 속성/ActiveExplorer 메소드 사용하기 (0) | 2021.10.05 |
댓글을 달아 주세요