private void BrowseOutlookFolders_Click(object sender, SourceGrid2.PositionEventArgs e) { try { // display the Outlook PickFolder dialog MAPIFolder folder = syncMgr.AppOutlook.Session.PickFolder(); if (folder == null) { // they clicked cancel or something. do nothing } else { // make sure they've specified a valid task folder if (folder.DefaultItemType == OlItemType.olTaskItem) { // update the grid gridProjects[e.Position.Row, col_SyncFolder].Value = Utils.GetShortOutlookFolderName(folder.FolderPath); gridProjects[e.Position.Row, col_SyncFolderFull].Value = folder.FolderPath.Replace("\\\\", ""); // add an event handler for the selected folder if not present syncMgr.AddSingleFolderEventHandler(folder, true); // remove the folder from ingored folder list, if appropriate if (syncMgr.Settings.IgnoredFolders.Contains(folder.FolderPath)) { syncMgr.Settings.IgnoredFolders.Remove(folder.FolderPath); } // TODO: prompt the user if they would like to move existing tasks // for this project to the new folder and if so, move them. } else { MessageBox.Show(this, "Please select a Task Item folder.", "Invalid Folder", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } catch (System.Exception ex) { ErrorHandler.PublishError(ex, syncMgr.Logger); } }