Delete Outlook Mailbox folders

How can we delete outlook mailboxes at first level?
For ex: John/Inbox, Robert/Inbox, etc - All these folders are at first level.

Any script or with any UiPath activity(which i wasn’t able to find)?

Hi @Sunny_J

Yes, it’s possible. Please try with below powershell script in UiPath.

Code:

$Outlook = New-Object -ComObject Outlook.Application
$Namespace = $Outlook.GetNamespace(“MAPI”)
$RootFolder = $Namespace.GetDefaultFolder(6) #6 represents the Inbox folder
$Folders = $RootFolder.Folders
$FoldersToDelete = @(“John”, “Robert”) #Add the mailbox names you want to delete in this array
foreach ($Folder in $Folders) {
if ($FoldersToDelete -contains $Folder.Name) {
$Folder.Delete()
}
}

Regards,
Kaviyarasu N

1 Like

Hi @Sunny_J ,

Check this below UiPath Marketplace component to delete outlook folder,

Hope this might help you :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.