tamagogi Posted April 7, 2010 Share Posted April 7, 2010 Hi, how can I read the rules from exchange server in autoit? I have a domain with active directory with mail object. I query it with ldap. What are attributes for a rule that forward mail to another user? Sorry for my english. Thanks Link to comment Share on other sites More sharing options...
ptrex Posted April 8, 2010 Share Posted April 8, 2010 @tamagogi Did a quick translation of something I found on Google. expandcollapse popup#include <date.au3> Const $ACTION_MOVE = 1 Const $CdoPR_SUBJECT = 0x37001E Const $IGNORECASE = 0x10000 $objRules = ObjCreate("MSExchange.Rules") $objRule = ObjCreate("MSExchange.Rule") $objPropVal = ObjCreate("MSExchange.PropertyValue") $objAction = ObjCreate("MSExchange.Action") $objContCond = ObjCreate("MSExchange.ContentCondition") $objSession = ObjCreate("MAPI.Session") $strProfile = "MailServer" & @LF & "MailboxAlias" $objSession.Logon("",Default,Default, 0,Default, 1, $strProfile) $objInbox = $objSession.Inbox $CdoInfoStore = $objSession.GetInfoStore $CdoFolderRoot = $CdoInfoStore.RootFolder $CdoFolders = $CdoFolderRoot.Folders $bFound = 0 $CdoFolder = $CdoFolders.GetFirst Do If $CdoFolder.Name = "Junk E-mail" Then $bFound = 1 Else $CdoFolder = $CdoFolders.GetNext EndIf $ActionFolder = $CdoFolder $objRules.Folder = $objInbox $objPropVal.Tag = $CdoPR_SUBJECT $objPropVal.Value = "SPAM:" $objContCond.Value = $objPropVal $objContCond.PropertyType = $CdoPR_SUBJECT $objContCond.Operator = 1 + $IGNORECASE $objAction.ActionType = $ACTION_MOVE $objAction.Arg = $ActionFolder $objRule.Name = "Move rule for Spam Tagging" $objRule.Condition = $objContCond $objRule.Actions.Add(, $objAction) $objRules.add(, $objRule) $objRules.update() $objSession.Logoff() While (Not $bFound) And Not ($CdoFolder = "") Not tested of course rgds ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
tamagogi Posted May 4, 2010 Author Share Posted May 4, 2010 Thanks for your answer and Im' sorry for my delay. Your script work for logged store mail with user and password. I'm trying to read the rules through Redemption.RDOSession object without logging. Many thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now