0

I have a c# outlook add-in and I would like to monitor for folder rename/changes.

After some searching, it looks like I need to monitor for the even, FoldersEvents_FolderChangeEventHandler

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
  ...
  // monitor for folder changes
  var folders = Application.Session.DefaultStore.GetRootFolder().Folders;
  folders.FolderChange += Folders_FolderChange;
}

...
private void Folders_FolderChange(Outlook.MAPIFolder folder)
{
  //
}

But the code is not called when I rename any folders, (or I move them and so on).

So, how can I monitor for changes in any of the folders?

I would like to monitor, Rename, Delete and Add, how can this be done?

1 Answer 1

1

You are setting up an event sink on a local variable (folders) that gets released by the GC next time it runs. Make it a global (class) member.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.