Sign in to follow this  
Followers 0
Sticky

Outlook UDF

3 posts in this topic

Referring to: Outlook UDF

I'm attempting to clear out my Outlook 2007 Sync Issues and Conflicts with this. In case you are wondering as to why, our BES server, Exchange, and ESET Antivirus don't play well, so all BES users have almost doubled their mailbox size due to sync issues and conflicts.

When I use:

_OutlookDeleteMail($oOutlook,$olFolderConflicts,"","","",True,True,"\\angela\NETLOGON\OutlookWarning2.exe")

@error states: Illegal parameters

If I use this:

_OutlookDeleteMail($oOutlook,$olFolderConflicts,"@","","",True,True,"\\angela\NETLOGON\OutlookWarning2.exe")

@error states: Mail not found/Folder not found.

If I try to delete the folder with:

_OutlookFolderDelete($oOutlook, $olFolderConflicts, True)

@error states: Error when deleting folder.

I'm at a loss as to what I'm doing wrong... I've also tried just "." or " " in place of the "@" to try to get some emails to delete returned.

Share this post


Link to post
Share on other sites



Something like this works for me:

const $olFolderCalendar=9
const $olFolderContacts=10
const $olFolderDeletedItems=3
const $olFolderDrafts=16
const $olFolderInbox=6
const $olFolderJournal=11
const $olFolderJunk=23
const $olFolderNotes=12
const $olFolderOutbox=4
const $olFolderSentMail=5
const $olFolderTasks=13
const $olPublicFoldersAllPublicFolders=18
const $olFolderConflicts=19
const $olFolderLocalFailures=21
const $olFolderServerFailures=22
const $olFolderSyncIssues=20
Local $text,$text2,$myItem,$myItem1,$oOApp,$myNamespace,$myFolder

$oOApp = ObjCreate("Outlook.Application")
$myNamespace =$oOApp.GetNamespace("MAPI")
$myFolder = $myNamespace.GetDefaultFolder($olFolderOutbox) ; replace this with the folder you want to empty.
$myItem = $myFolder.Items().Count
$myItem1 = $myFolder.Items($myItem)
$myItem1.Delete()

This will delete last item. Just put it in a loop until Items().Count=0

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank you! Thank you! This did the trick!

const $olFolderConflicts=19
const $olFolderSyncIssues=20
Local $myItems,$myItem,$oOApp,$myNamespace,$myFolder

$oOApp = ObjCreate("Outlook.Application")
$myNamespace =$oOApp.GetNamespace("MAPI")

$myFolder = $myNamespace.GetDefaultFolder($olFolderConflicts)
$myItems = $myFolder.Items().Count
For $i = $myItems To 1 Step -1
    $myFolder.Items($i).Delete()
Next
$myFolder = $myNamespace.GetDefaultFolder($olFolderSyncIssues)
$myItems = $myFolder.Items().Count
For $i = $myItems To 1 Step -1
    $myFolder.Items($i).Delete()
Next
Edited by Sticky

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0