2012-05-03 8 views
0

現在、私は特定のアーカイブフォルダを作成するOutlookアドインを作成することを目指しています。普通のものとの違いは、鉱山はムーブインやムーブアウト中に商品の内容を完全に制御できることです。Outlook 2010特別フォルダアドイン

まもなく、アイテムのバイナリコンテンツが本当に自分のフォルダに移動さ​​れる前にスキャンするか、フォルダから削除する必要があります。私はその項目のいくつかをネットワークの場所にコピーしようとしています。

アドインを作成するために、プロジェクトオフィス(VSTO)のVisual Studioツールを作成することによって、あなたはよ、私の状況

答えて

1

あなたは、Visual Studio 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() 
{ 
} 

をイベントハンドラを使用して作業を実行します。

関連する問題