2012-05-03 4 views
0

현재 특정 보관 폴더를 만드는 Outlook 추가 기능을 만드는 것이 목표입니다. 일반적인 것에서의 차이점은 광산이 입주 중 또는 출퇴근 중 물품의 내용을 완전히 통제 할 수 있어야한다는 것입니다.Outlook 2010 특수 폴더 추가 기능

곧바로 항목의 바이너리 콘텐츠를 내 폴더로 이동하거나 내 폴더에서 삭제하기 전에 스캔 할 수 있어야합니다. 그 항목 중 일부를 네트워크 장소에 복사하려고합니다.

추가 기능을 작성하는 프로젝트 사무소 (VSTO)에 대한 Visual Studio 도구를 만들어 사용하면거야, 내 상황

답변

1

당신은 비주얼 스튜디오 2010을 사용하고 있다는 가정을 위해 가장 가능성 시작을 내 오른쪽 문서 나 샘플을 조언을 바랍니다 -에서. VSTO 및 Visual Studio에 대한 자세한 내용은 here을 참조하십시오.

일단 실행하고 나면 추가 기능에 "기본 진입 점"이 포함 된 ThisAddIn.cs라는 소스 파일을 갖게됩니다. 거기에서 특정 이벤트가 발생할 때 Outlook에서 발생시키는 이벤트에 연결할 수 있습니다. 당신은 대부분 다음과 같은 이벤트에 관심이있을 것입니다 :

  • BeforeFolderSwitch
  • FolderSwitch

다음과 같이 보일 것입니다 귀하의 코드 :

귀하의 코드들에 배치해야합니다

private void ThisAddIn_Startup(object sender, EventArgs e) 
{ 
    var explorer = this.Application.ActiveExplorer(); 
    explorer.BeforeFolderSwitch += new ExplorerEvents_10_BeforeFolderSwitchEventHandler(explorer_BeforeFolderSwitch); 
    explorer.FolderSwitch += new ExplorerEvents_10_FolderSwitchEventHandler(explorer_FolderSwitch); 
} 

/// <summary> 
/// Handler for Outlook's "BeforeFolderSwitch" event. This event fires before the explorer goes to 
/// a new folder, either as a result of user action or through program code. 
/// </summary> 
/// <param name="NewlySelectedFolderAsObject"> 
/// The new folder to which navigation is taking place. If, for example, the user moves from "Inbox" 
/// to "MyMailFolder", the new current folder is a reference to the "MyMailFolder" folder. 
/// </param> 
/// <param name="Cancel"> 
/// A Boolean describing whether or not the operation should be canceled. 
/// </param> 
void explorer_BeforeFolderSwitch(object NewlySelectedFolderAsObject, ref bool Cancel) 
{ 
    if (NewlySelectedFolderAsObject == null) 
     return; 
    var newlySelectedFolderAsMapiFolder = NewlySelectedFolderAsObject as MAPIFolder; 
} 

void explorer_FolderSwitch() 
{ 
} 
이벤트 핸들러를 사용하여 작업을 수행 할 수 있습니다.