Sunday, 15 May 2011

Outlook vsto - Folder restrictions -


I have a little Outlook 2010 addin and need to restrict some actions in a custom folder:

  • Can I stop a user from renouncing a folder?
  • Is it possible for the user to stop moving any object in the folder? I know the item ad event, but it was only removed when the item was already taken. It's too late for me.
  • Is it possible to disable the context menu (right click) of a folder?

    Thank you very much!

    // Edit: I think I have found a solution to the context menu problem Is it OK or is there any defect in doing this?

      approach. Folder Contextmay Display + = DisableArchiveFolderContext Menu; Private Zero DisabledFolderContact menu (Office.CommandBar commandbar, MAPIFolder folder) {If (folder.Name.Equals (Settings.Default.ArchiveFolderName)) // // Disable Context Menu Command.Bar.Enabled = false; } And {commandBar.Enabled = true; Take a look at how to prevent items from being moved to your folder;}}    

    This event will need to be attached to each folder that you are interested in viewing - any global never before I know. You have to repeat each mailbox folder or late and attach your item listener. However, there are limitations of the folder switch as long as you can transfer items without switching folders through the folder inspector ribbon, OWA or EWS.

    To keep users from changing their folder names, folder names that are implemented through reference parent's folder continue.

      public partial class ThisAddIn {Outlook.Folder folder; Outlook Foster Customfolder; Outlook.Folders Mailbox; Outlook.Explorer Explorer; Private Zero This AdDin_startup (Object Sender, System.EventArgs e) {explorer = Globals.ThisAddIn.Application.ActiveExplorer (); Explorer.FolderSwitch + = New Outlook.ExplorerEvents_10_FolderSwitchEventHandler (explorer_FolderSwitch); Mailbox = globals. This addin. Session DefaultStore.GetrootFolder (). Folder; (Mailbox.exe & lt; outlook.folder & gt; (). Where (c => c.Name == "custom folder"). Calculation () == 0} {customFolder = mailbox.Add (" Custom folder ") as Outlook.Folder; Outlook.StorageItem si = customFolder.GetStorage ("Custom Folder Store", Outlook.OlStorageIdentifierType.olIdentifyBySubject); Si.UserProperties.Add ("PermanentFolderName", Outlook.OlUserPropertyType.oltext) .Value = customfolder.Name; // store constant name si.Save (); } Else customFolder = Mailbox ["Custom Folder"] as Outlook.Folder; Mailbox.FolderChange + = New Outlook.FoldersEvents_FolderChangeEventHandler (Mailbox_fonder folder); } Void explorer_FolderSwitch () {folder = explorer.CurrentFolder as Outlook.Folder; // grab new handle folder. Before this, EDM + = new Outlook.MAPIFFEDEREvents_12_BeforeItemMoveEventHandler (folder_BEforeItemMove); } Zero mailbox_folder changes (Outlook.MAPIFolder folder) {Outlook.Folder folder = folder as Outlook.Folder; Outlook.StorageItem si = folder.GetStorage ("Custom Folder Store", Outlook.OlStorageIdentifierType.olIdentifyBySubject); If (SICX> 0 & amp; amp; si.UserProperties.Count & gt; 0 & amp; amp; si.UserProperties ["PermanentFolderName"]. Value! = Folder.name) folder.Name = C. Userpieces ["permanentfoldername"] .Value; // override user name changed} void folderbearyearmow (object item, outlook. Mappi folder slip, cancel riff bill) {Cancel (httotono name == "custom folder") = true; // to reject moving objects}}    

No comments:

Post a Comment