- How to delete archive folder in outlook 2016 how to#
- How to delete archive folder in outlook 2016 windows 10#
- How to delete archive folder in outlook 2016 windows#
Nevertheless, sometimes you may need to create additional data files for archiving, categorizing, etc. ps1 file, right-click on the script and choose Run with PowerShell.How to add, close and remove data file in Outlook?īy default data files are created automatically for each email account. To use it, you need to allow local scripts by running this command:
How to delete archive folder in outlook 2016 windows#
To open it in the PowerShell IDE, type powershell on the start menu and click on Windows PowerShell IDE when the PowerShell app is found. ps1 file, paste it into Notepad and save it with the extension. You'll need to use the macro version if you have the Windows store version of Office installed. Note: This PowerShell script will not work with the Windows Store version of Office. Paste the entire script in the PowerShell window and press Enter.
How to delete archive folder in outlook 2016 windows 10#
To use, right-click on the Start menu in Windows 10 and click on the Windows PowerShell entry.
How to delete archive folder in outlook 2016 how to#
More information as well as screenshots are at How to use the VBA Editor Press F5 or the Run button to run the macro.Copy and paste the macro into the new module.Right click on Project1 and choose Insert > Module.Open the VBA Editor by pressing Alt+F11 on your keyboard. The macros on this page should be placed in a module. In Outlook 2007 and older, look at Tools, Macro Security.Īfter you test the macro and see that it works, you can either leave macro security set to low or sign the macro. To check your macro security in Outlook 2010 and newer, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. You can sign the macro when it is finished and change the macro security to notify. You could choose the option Notification for all macros, then accept it each time you restart Outlook, however, because it's somewhat hard to sneak macros into Outlook (unlike in Word and Excel), allowing all macros is safe, especially during the testing phase. The macros will not work with the top two options that disable all macros or unsigned macros. If olNewFolder.Name "Deleted Items" Thenįirst: You need to have macro security set to the lowest setting, Enable all macros during testing. 'Don't need to process the Deleted Items folder Set olTempFolder = CurrentFolder.Folders(i)įor Each olNewFolder In CurrentFolder.Folders Select the Deleted items folder to permanently delete the folders.įor i = To 1 Step -1 It will delete all subfolders from the selected folder. To use this macro, select the parent folder then run the macro. ' Loop through and search each subfolder of the current folder.įor Each olNewFolder In CurrentFolder.folders
Set olTempFolder = CurrentFolder.folders(i) ' Loop through the items in the current folder.įor i = To 1 Step -1
Sub ProcessFolder(CurrentFolder As Outlook.MAPIFolder) To use, select the parent folder (can be the mailbox root, which may be your email address or 'Outlook Data File') then run the DeleteFolders macro. If Left(olTempFolder.Name, 6) = "Notes_" Then Edit this line for the folder name and the character count as needed.
Use this macro to delete all folders that begin with the same name. $SubFolder = $Inbox.Folders | Where-Object To delete a specific subfolder by name, use this line: #$Folder = $("Deleted Items")ĭelete subfolders by name or using wildcards # to permanently delete subfolders from Deleted items folder
$Folders = delete subfolders from the parent folder You'll run the same script twice, once with the folder you are deleting subfolders from, then for the deleted items folder. This will be the name you see in the folder list, in most cases it will be your email address but may be Outlook Data file or Personal Folders. To delete from a secondary or non-default data file in your profile, you need to identify the data file by name. # permanently delete subfolders from Deleted items folder $olApp = new-object -comobject outlook.application To change the default parent folder, change the folder number in this line (a list of common folder values is at the end of the powershell script listings): The first script deletes the subfolders under the Inbox, the second script permanently deletes all of the subfolders in the Deleted Items folder. They also delete the folders from the deleted items folder. The two PowerShell scripts delete subfolders of the Inbox (or subfolders of a specific folder) or all folders beginning with the same name, at the same level as the Inbox. You'll need to select the Deleted items folder and run it again to permanently delete the folders. The macro on this page runs on the selected folder, moving all subfolders to the deleted items folder. To speed it up you can use a macro or PowerShell.