Empty an Office365 public folder containing 20.000 messages

Status
Not open for further replies.

SaintNick

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It used to be possible with OWA to empty a public folder. That option is now gone.

MFCMAPI tool also can't open the PF store (MAPI_E_NOT_FOUND == 0x8004010F at CallOpenEntry).

Delete and recreate the folder is not an option because among other things it's email enabled, and it's a thing I need to do frequently.

Anyone else any idea's?

Powershell script maybe? Although that would be APITA because first I'd have to disable two-factor authentication in the admin center. (Powershell does not support 2F-authentication).
 
Could you run a macro to empty it from one of the computers?

This might work, although it likely would need changed to count down...


Code:
Option Explicit
Public Sub DoSomethingFolder()
    Dim objOL As Outlook.Application
    Dim objItems As Outlook.Items
    Dim objFolder As Outlook.MAPIFolder

    Set objOL = Outlook.Application
    Set objFolder = objOL.ActiveExplorer.CurrentFolder
    Set objItems = objFolder.Items

Dim i As Long
  For i = objFolder.items.Count To 1 Step -1
  objFolder.items(i).Delete
  Next

  Set obj = Nothing
  Set objFolder = Nothing
  Set objOL = Nothing
End Sub
 
Dang Enter key. :) Not only did i post it before it was finished, i also forgot a few lines. :)

The updated code above should delete all messages in the currently selected folder. It uses the macro at Working with All Items in a Folder or Selected Items as the base, but because it's deleting messages, you need to count backwards, otherwise you'll only delete every other one.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
V Checking for empty field Outlook VBA and Custom Forms 2
Paul Hobbs Automatically accept "Empty Folders" prompt Outlook VBA and Custom Forms 6
vodkasoda Hiding empty Folders Outlook VBA and Custom Forms 0
I Outlook 2003 shows html code when To: field is empty Using Outlook 7
S Conditional formatting problem with "is not empty" and categories Using Outlook 2
Daniel Schunk User-defined form arrives empty at the recipient Using Outlook 3
semnaitik Archive PST is not empty but can't see old emails Using Outlook 2
M Multiple spurious empty folders appear in archive files Using Outlook 3
B Choose commands from Macros is empty Outlook VBA and Custom Forms 3
I Many empty Contacts folders.. cannot get rid of them Using Outlook 4
wisedave IMAP Mail Directory Keeps Going Empty Using Outlook 5
A Mysterious random appearance of empty unsent email Using Outlook 3
A Prompt on exit to empty deleted items folder "for all accounts" does not work? Using Outlook 6
M empty fields after Contact History personalisation BCM (Business Contact Manager) 0
S 2010 outlook today looks like an empty email box Using Outlook 4
A email folders appear empty, at first click Using Outlook 2
H Calendar Folder property is empty Using Outlook 1
M Contact Manager field is empty BCM (Business Contact Manager) 0
S Please help! -- Linked Account field at Business Contacts tab is always empty BCM (Business Contact Manager) 1
B In Box Empty Using Outlook 5
P Imap Folders are present, but the inbox folder is empty except for new message Using Outlook 3
V What is wrong with Outlook Connector - it still errors out on an EMPTY Hotmail Using Outlook.com accounts in Outlook 3
M How to clean duplicate/empty e-mail address fields in Outlook contacts Using Outlook 0
R Why Internet headers empty? Exchange Server Administration 2
M Empty Deleted items folder - Other users folder Outlook VBA and Custom Forms 1
M Received date empty Outlook VBA and Custom Forms 5
T Outlook Forms Not Working - Fields Empty Outlook VBA and Custom Forms 7
J GoDaddy migrated to Office365 - Outlook Wont Add Account Exchange Server Administration 21
J Connect outlook to office365 exchange _without_ signing in office apps Using Outlook 4
D Outlook 2016 and Earlier with Office365 in 2021 Using Outlook 3
C Outlook with Office365 - search across account, by date rate, in multiple folders - how? Using Outlook 2
P Shortcut Pane - add shortcut to Office365 group mailbox Using Outlook 1
I Outlook 2010 Transition Office365 Home Using Outlook.com accounts in Outlook 5
M Moving mail to another folder is much slower than before (Office365) Using Outlook 0
D Office365 Conference Room name change? Using Outlook 5
S Outlook [Online - Office365] perfomance is getting affected when accessing the mails using Redemptio Using Outlook 1
GoofyDK Office365 and meeting ressources Using Outlook 2
B Can't Connect to Office365 Exchange Server Exchange Server Administration 2
P What Are Alternatives for New Email Client After Office365 Using Outlook 8
A Outlook.com migrating to Office365, contacts Using Outlook.com accounts in Outlook 3
Diane Poremsky New Office365 Feature: URL Preview in OWA Using Outlook 0
M office365 causing mouse lag? Exchange Server Administration 4
B Sync Outlook Public Folders to Contacts Using Outlook 2
J How to import many msg into different public folders in Outlook Outlook VBA and Custom Forms 7
A Moving Public Folders to New Database Exchange Server Administration 3
Fozzie Bear Shared Public Folders Access and Use Exchange Server Administration 0
A Created a personal group that now appears to be a public group Using Outlook 3
A Prevent connection to Public Folders on Exchange? Exchange Server Administration 3
R Call a Public Sub when a Flag is clicked on in the Message Preview pane Outlook VBA and Custom Forms 1
R Copy Outlook Public Folders to a File Server Shared Folder Using Outlook 0

Similar threads

Back
Top