Welcome! Log In


UPDATE: easiest way to clean old mails in a public folder in exchange:

https://groups.google.com/forum/?fromgroups=#!topic/microsoft.public.exchange.admin/dbI_LK2kRas

1)Open Microsoft Exchange System Manager
2)Expand `Administrative Groups?
3)Select the required administrative group -> `Servers?
4)Click on the Server and then click on the required Storage Group
5)Expand `Public Folder Store?
6)Click on `Public Folder Instances?
7)Right-click on the public folder you want to modify and select `Replica Properties?
8)Enable `Age Limit of this folder on this public store (days);’
9)Enter the number of days that you want to keep the public folder contents (anything older will be automatically deleted)
10)Click OK to apply the changes


Ce script VBS est donc à exécuter sur une machine où est configuré Outlook sur une session utilisateur qui a bien sûr des droits de suppression sur un dossier publique ^^


Original script: http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24444396.html


dtmCutOff = DateAdd("d",-15,Date)

Set objOLK = CreateObject("Outlook.Application" )
Set objNS = objOLK.Application.GetNamespace("MAPI" )
Set objPF = objNS.Folders("Dossiers publics" ).Folders("Tous les dossiers publics" ).Folders("Mondossierracine" ).Folders("mondossiermails" )
Set objDict = CreateObject("Scripting.Dictionary" )

For Each objItem In objPF.items
If DateDiff("d",dtmCutOff,objItem.receivedTime) <= 0 Then
intDeleted = intDeleted + 1
objDict.Add objItem.entryID, objItem.subject & " " & objItem.receivedTime

If intDeleted > 2000 Then Exit For
End if
Next

For Each dictKey In ObjDict.Keys
WScript.Echo "DELETING : " & objDict.Item(dictKey)
objNS.GetItemFromID(dictKey).Delete
Next

WScript.Echo "Total " & intDeleted & " items deleted."

'Clean up
objOLK.Quit
Set objOLK = Nothing
Set objNS = Nothing
Set objPF = Nothing
Set objDict = Nothing



Edited 2 time(s). Last edit at 10/15/2012 04:37PM by iznogoud.
Sorry, only registered users may post in this forum.

Click here to login