Search the Community
Showing results for tags 'outlook'.
-
I was in a hurry to convert 200+ address book from Google Contacts (G Suite, contacts exported in .CSV with Google Takeout, but the contact format is the same for every Google Gmail account) to Outlook contacts, so I developed this quick and very dirty script. Starting from a .CSV exported from Google, you can run the script and you have the contacts ported directly (no outlook import) on the Outlook Address book. In my experience, the fields of Google contacts are not fixed in number and maybe also in position, so I made the choice to import only certain fields to Outlook, scanning every line. These fields, exact google names: "Given Name" "Family Name" "E-mail 1 - Value" "E-mail 2 - Value" "Phone 1 - Value" "Phone 2 - Value" "Website 1 - Value" "Notes" "Name" "Address 1 - Formatted" Also the lines of google contacts can be weird as CR and LF are not "regular". I include my code, (worked with no errors on a lot of conversions) and also a very small fake adress book with examples of problems I encountered and resolved. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icone\Win98-ico\script_file_teal.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;GOA2OAB ;G.oogle A.ddress B.ook 2 (to) O.utlook A.ddress B.ook ;(C) NSC 2019 ; convert a google (takeout) address book to an Outlook Address Book #include <File.au3> #include <Array.au3> #include <_Gollog.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <String.au3> #include <Math.au3> ; ***************************************************************************** #include <OutlookEX.au3> ; super perla pearl outlook create contacts !!!!! ; ***************************************************************************** Global $oItem Global $oOutlook = _OL_Open() If @error <> 0 Then MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; ***************************************************************************** Global $ver = "V.0.8192", $tempdir = "c:\GAB2OAB_temp", $File2convert, $aRetArray, $workfile = $tempdir & "\work-GAB2OAB.csv", $workfile2 = $tempdir & "\WORK2-gab2oab.csv", $FINALab = $tempdir & "\NEW-ab.csv", $A3clean[0], $A4clean[0], $A5clean[0] ; Gollog Autogenerated Gui $mygui = "G.oogle A.ddress B.ook 2 (to) O.utlook A.ddress B.ook " & $ver & " NSC 2019" gollog_ini($mygui, 600, 200, 50, 50, "0x0033cc", "0xA8D9BD", "courier", 8, 600, @ScriptDir & "\GAB2OAB_log.txt") ; initialization with colors and font choice, more options see the UDF Gollog(">>>>>>>> GAB2OAB " & $ver) $File2convert = FileOpenDialog("Select Google Address Book File", @DesktopDir & "\", "CSV (*.csv)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) Gollog("selected " & $File2convert) If Not FileExists($tempdir) Then Gollog("creating " & $tempdir) DirCreate($tempdir) EndIf If FileExists($workfile) Then Gollog("deleting " & $workfile) FileDelete($workfile) EndIf If FileExists($workfile2) Then Gollog("deleting " & $workfile2) FileDelete($workfile2) EndIf If FileExists($FINALab) Then Gollog("deleting " & $FINALab) FileDelete($FINALab) EndIf cleanfile() readfile() cleanfile2() readfile2() write2Outlook() Exit Func write2Outlook() Gollog("---> Assigning Fields...") Sleep(300) Local $FirstName = 4 ; initialize with Yomi name - always empty in tested companies, low class workaround Local $LastName = 4 Local $Email1Address = 4 Local $Email2Address = 4 Local $MobileTelephoneNumber = 4 Local $OtherTelephoneNumber = 4 Local $Webpage = 4 Local $Body = 4 Local $Fullname = 4 Local $BusinessAddress = 4 For $z = 0 To UBound($A5clean, 2) - 1 ;If $A5clean[2][$z] = "Additional Name" Then $MiddleName = $z ; limit @ 10 If $A5clean[1][$z] = "Given Name" Then $FirstName = $z If $A5clean[1][$z] = "Family Name" Then $LastName = $z If $A5clean[1][$z] = "E-mail 1 - Value" Then $Email1Address = $z If $A5clean[1][$z] = "E-mail 2 - Value" Then $Email2Address = $z If $A5clean[1][$z] = "Phone 1 - Value" Then $MobileTelephoneNumber = $z If $A5clean[1][$z] = "Phone 2 - Value" Then $OtherTelephoneNumber = $z If $A5clean[1][$z] = "Website 1 - Value" Then $Webpage = $z If $A5clean[1][$z] = "Notes" Then $Body = $z If $A5clean[1][$z] = "Name" Then $Fullname = $z If $A5clean[1][$z] = "Address 1 - Formatted" Then $BusinessAddress = $z Next Gollog("Fields Found !") For $i = 2 To UBound($A5clean, 1) - 1 Gollog("Contact 2 Outlook line " & $i) ;Gollog($A5clean[$i][1]) ; Create a contact with first- and lastname ; ***************************************************************************** $oItem = _OL_ItemCreate($oOutlook, $olContactItem, "", "", "FullName=" & $A5clean[$i][$Fullname], "BusinessAddress=" & $A5clean[$i][$BusinessAddress], "FirstName=" & $A5clean[$i][$FirstName], "LastName=" & $A5clean[$i][$LastName], "Email1Address=" & $A5clean[$i][$Email1Address], "Email2Address=" & $A5clean[$i][$Email2Address], "WebPage=" & $A5clean[$i][$Webpage], "MobileTelephoneNumber=" & $A5clean[$i][$MobileTelephoneNumber], "OtherTelephoneNumber=" & $A5clean[$i][$OtherTelephoneNumber], "Body=" & $A5clean[$i][$Body]) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate ", "Error creating a contact'. @error = " & @error & ", @extended = " & @extended) ; Add a picture to the contact ;$oItem.AddPicture(@ScriptDir & "\The_Outlook.jpg") $oItem.Save() ; ***************************************************************************** Next MsgBox(64, "OutlookEX UDF: the magic was made!", "All contacts successfully created ") _OL_Close($oOutlook) ; close the connection to Outlook EndFunc ;==>write2Outlook Func cleanfile() Gollog('start check for unwanted LF... / final rogue "') Sleep(300) Local $A2Clean = FileReadToArray($File2convert) ;_ArrayDisplay($A2Clean, "original file", Default, 8) Local $dimLIST = UBound($A2Clean) - 1 Local $string2write = "" Local $Astring1 = "" Local $Astring2 = "" Local $salvaAstring1 = "" Local $openLF = 0 ; we are between "LF" across lines For $i = 0 To $dimLIST Gollog('workin on line ' & $i) ;Gollog($A2Clean[$i]) $Astring1 = StringToASCIIArray($A2Clean[$i]) ;_ArrayDisplay($Astring1) Local $DimAstring1 = UBound($Astring1) - 1 If $openLF = 1 Then ;check new line if start with " $Astring2 = StringToASCIIArray($A2Clean[$i]) If $Astring2[0] = "34" Then ; gollog('found initial " ') $openLF = 2 Else Gollog('error new line not starting with "') MsgBox(48, "error", 'error new line not starting with "') EndIf EndIf If $Astring1[$DimAstring1] = "34" Then ; gollog('First line -> Found final "') If $openLF <> 0 Then $salvaAstring1 = $salvaAstring1 & $A2Clean[$i] Else $salvaAstring1 = $A2Clean[$i] EndIf Else _ArrayAdd($A3clean, $salvaAstring1 & $A2Clean[$i]) ;Gollog("adding to cleaned array state:" & $openLF) $openLF = 0 $salvaAstring1 = "" EndIf Next Gollog('end clean from rogue "') ;_ArrayDisplay($A3clean, 'cleaned from rogue "') ;___________________________________P-PP-PP,P------------------------------------------------- Gollog('Start joining lines based on ODD " ') Sleep(300) ;_MathCheckDiv ( $iNum1 [, $iNum2 = 2] ) pari e dispari perla pearl Local $hFileOpen = FileOpen($workfile2, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the file.") Return False EndIf Local $dimLIST = UBound($A3clean) - 1 Local $Astring1 = "" Local $Astring2 = "" Local $dimSTRING = "" Local $AapiciINriga Local $numeroapiciINriga = 0 Local $sommaNumeroapiciINrighe = 0 Local $salvaAstring1 = "" Local $dispari = 0 For $i = 0 To $dimLIST Gollog("workin' on line " & $i) $Astring1 = StringToASCIIArray($A3clean[$i]) ;_ArrayDisplay($Astring1) ;Gollog($A3clean[$i]) $AapiciINriga = _ArrayFindAll($Astring1, '34') If $AapiciINriga <> -1 Then $numeroapiciINriga = UBound($AapiciINriga) ; Gollog("N° " & $numeroapiciINriga & " apici in riga " & $i) $sommaNumeroapiciINrighe += $numeroapiciINriga If _MathCheckDiv($sommaNumeroapiciINrighe) = 1 Then $salvaAstring1 = $salvaAstring1 & $A3clean[$i] $dispari = 1 Else Local $towrite = $salvaAstring1 & $A3clean[$i] ; gollog("scrivo " & $towrite) FileWriteLine($hFileOpen, $towrite) $salvaAstring1 = "" $sommaNumeroapiciINrighe = 0 $dispari = 0 EndIf Else ; Gollog("zero apici in riga " & $i) If $dispari = 1 Then ;linea vuota o senza apici ma " aperte dispari $salvaAstring1 = $salvaAstring1 & $A3clean[$i] Else Local $towrite = $salvaAstring1 & $A3clean[$i] ; gollog("scrivo " & $towrite) FileWriteLine($hFileOpen, $towrite) $salvaAstring1 = "" $sommaNumeroapiciINrighe = 0 $dispari = 0 EndIf EndIf Next Gollog('END joined lines based on ODD "') ;_ArrayDisplay($A4clean, 'joined lines based on ODD "') FileClose($hFileOpen) EndFunc ;==>cleanfile Func readfile() gollog("reading work file and creating multiD array") Sleep(300) $A4clean = FileReadToArray($workfile2) If @error = 1 Or @error = 2 Then gollog("error reading work2 file " & @error) Else ; _ArrayDisplay($A4clean, "cleaned 1", Default, 8) EndIf EndFunc ;==>readfile Func cleanfile2() Local $dimLIST = UBound($A4clean) - 1 Local $Astring1 = "" Local $conta = 0 Local $salvaconta = 0 Local $dimSTRING = "" $salvalinea = "" Local $standardNumeroVirgole = 0 Local $hFileOpen = FileOpen($FINALab, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the file.") Return False EndIf Gollog('Checkin , number') For $i = 0 To $dimLIST ;Gollog('workin on line ' & $i) $Astring1 = StringToASCIIArray($A4clean[$i]) ;_ArrayDisplay($Astring1) $dimSTRING = UBound($Astring1) - 1 For $y = 0 To $dimSTRING If $Astring1[$y] = "44" Then ; secondo step , $conta += 1 EndIf Next If $i = 0 Then $standardNumeroVirgole = $conta gollog("----------numero virgole -> " & $standardNumeroVirgole) EndIf If $conta = $standardNumeroVirgole Then FileWriteLine($hFileOpen, $A4clean[$i]) EndIf If $conta > $standardNumeroVirgole Then Gollog('>>> Line ' & $i & ' Virgole' & $conta) $toprecise = $A4clean[$i] $tofinal = '' While StringInStr($toprecise, '"') <> 0 $tofinal = preciseremoval($toprecise) ;super smart $toprecise = $tofinal WEnd FileWriteLine($hFileOpen, $toprecise) EndIf If $conta < $standardNumeroVirgole Then Gollog('<<< Line ' & $i & ' Virgole' & $conta) $salvalinea = $salvalinea & $A4clean[$i] $salvaconta += $conta If $salvaconta = $standardNumeroVirgole Then $salvaconta = 0 FileWriteLine($hFileOpen, $salvalinea) $salvalinea = 0 EndIf EndIf $conta = 0 Next FileClose($hFileOpen) EndFunc ;==>cleanfile2 Func writeWORKfile2() Gollog("writing work file") If _FileWriteFromArray($workfile, $A4clean) <> 1 Then gollog("error writing work file " & @error) EndIf EndFunc ;==>writeWORKfile2 Func readfile2() gollog("reading work file and creating multiD array") If _FileReadToArray($FINALab, $A5clean, Default, ",") = 0 Then MsgBox(48, "errore", @error) EndIf ;_ArrayDisplay($A5clean, "cleaned 2", Default, 8) EndFunc ;==>readfile2 Func preciseremoval($Pclean) ; llllllllllllllllllllllllll ---- pass 1 for ",," $Astring1 = StringToASCIIArray($Pclean) ;_ArrayDisplay($Astring1) $dimSTRING = UBound($Astring1) - 1 Local $salvadelete = "" Local $cond1 = 0 For $y = 0 To $dimSTRING If $cond1 = 1 Then ; , removed so exit from loop If $Astring1[$y] = "34" Then ; terzo step " in chiusura ; gollog('Found right "') If $salvadelete = "" Then $salvadelete = String($y) Else $salvadelete = $salvadelete & ";" & $y EndIf $cond1 = 0 ExitLoop EndIf EndIf If $cond1 = 1 Then If $Astring1[$y] = "44" Then ; secondo step , If $salvadelete = "" Then $salvadelete = String($y) Else $salvadelete = $salvadelete & ";" & $y EndIf EndIf EndIf If $Astring1[$y] = "34" And $cond1 = 0 Then ;PRimo step per primo ->" $cond1 = 1 ;gollog('Found left "') If $salvadelete = "" Then $salvadelete = String($y) Else $salvadelete = $salvadelete & ";" & $y EndIf ;Gollog("debug" & $salvaApici) EndIf Next ; Gollog("apici e virgole da togliere: " & $salvadelete) ;gollog("virgole togliere: " & $salvaVirgole) If _ArrayDelete($Astring1, $salvadelete) = -1 Then Gollog("error in arraydelete apici " & @error) gollog(StringFromASCIIArray($Astring1)) Else gollog(' PASS 1 removed unwanted ",," from line ') EndIf $Astring2 = StringFromASCIIArray($Astring1) $Pclean = $Astring2 Return $Pclean EndFunc ;==>preciseremoval You will need the OutlookEX.au3 , look at this link and also my logging UDF _Gollog.au3, attached. Used on Outlook from 2010 to 2016/365 with no problems. Hope this script can help someone. TEST1.csv _GOLLOG.au3
-
Version 1.7.0.1
10,091 downloads
Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None -
For a specific requirement the outbound email are managed by an on-prem EDGE server. The EDGE re-write the local on-prem email address with another domain [exposed domain - mx record-]. Everything is working fine but we are having an issue when the internal local users are requesting an invite meeting by Outlook calendar . In that case when the receiver accept the request invite it generate an error "domain not found". In this scenario the EDGE server is not able to rewrite also the calendar MIME request (V-card) header inside the message so when the receiver accepts the request the reply [mechanism] will fails as will be used the email address of the local user [domain not exposed ] and not the external one. I was wondering if Autoit is able to manipulate somehow the invite heade- calendar MIME (V-card))- re-witing the user email. Thanks
-
Excel VBA's IDE registers a Control-y as "cut this line of code". For those prone to Undo/Redo (Ctrl+Z/Ctrl+Y) you may find frustration when your code in the editor does not redo, but in fact clears your active line of code while killing redo history. Though not perfect, I keep this tool running in background on startup. The purpose is to allow Cltr+Y to act normally throughout Windows and Office and only interact *differently* with the "Microsoft Visual Basic for Applications" window that is active. If the Standard Menu bar exists, it'll try to click the ReDo (Blue Arrow to the right), else "Alt+e, r" keystrokes (less desired). Here's the code: Opt('MustDeclareVars', 1) Opt("WinTitleMatchMode", 1) HotKeySet("^y", "TriggerRedo") While 1 Sleep(10) WEnd Func TriggerRedo() ConsoleWrite("TriggerRedo()" & @CRLF) Local $title = "Microsoft Visual Basic for Applications - " Local $hWnd If WinExists($title) And WinActive($title) Then ;~ Parent Window Handle $hWnd = WinGetHandle($title) Local $aWindowPos = WinGetPos($hWnd) ;~ Control Bar Handle, Position and If Visible Local $sControlID = "[CLASS:MsoCommandBar; TEXT:Standard;]" Local $hStandardBar = ControlGetHandle($hWnd, "", $sControlID) Local $bIsVisible = ControlCommand($hWnd, "", $sControlID, "IsVisible") If $hStandardBar And $bIsVisible Then ConsoleWrite("Using Mouse Click." & @CRLF) ;~ Determine Redo button location on visible Control Bar Local $aBarPos = ControlGetPos($hWnd, "", $sControlID) Local $mX = $aWindowPos[0] + $aBarPos[0] + 217 + Int(23/2) Local $mY = $aWindowPos[1] + $aBarPos[1] + 27 + Int(22/2) MouseClick("Left", $mX, $mY, 1, 0) Else ConsoleWrite("Using VBA Send Keys." & @CRLF) $sControlID = "[CLASS:MsoCommandBar; TEXT:Menu Bar;]" Local $hMenuBar = ControlGetHandle($hWnd, "", $sControlID) ControlSend($hWnd, "", $hMenuBar, "!e") ;~ Send("r") $sControlID = "[CLASS:MsoCommandBarPopup; TEXT:Edit;]" Local $hPopupBar = ControlGetHandle($hWnd, "", $sControlID) ControlSend($hWnd, "", $hPopupBar, "r") EndIf Else ConsoleWrite("Using NATIVE Send Keys." & @CRLF) HotKeySet("^y") Send("^y") ;~ may cause "yyy..." when held HotKeySet("^y", "TriggerRedo") EndIf EndFunc ;==>TriggerRedo Hope this inspires someone.
-
Hi, I am trying to print items from Outlook in a Citrix machine. I am printing the items into PDF files using ‘Microsoft Print to PDF option’. I am using OutlookEX.au3 for printing items. Everything is working fine except handling the ‘Save Print Output As’ dialog appearing while trying to print the file to PDF. I have set the default printer to ‘Microsoft Print to PDF’ from the control panel ( Control Panel\All Control Panel Items\Devices and Printers) and using the following method to print the item. _OL_ItemPrint($oOutlook, $OL_Item) ;print item I am not able to handle the ‘Save Print Output As’ dialog initiated by the print statement in the Citrix machine. The WinActive method always returns false. I have tried with ControlSetText, ControlClick and Send methods also. Can anyone please help? Func _SavePDF($sFilePath) WinActivate ( "Save Print Output As", "") WinWaitActive ( "Save Print Output As", "",5 ) If WinActive("Save Print Output As") Then sleep(500) Send($sFilePath) sleep(500) Send("{ENTER}") sleep(500) EndIf EndFunc;=>_SavePDF
- 10 replies
-
Hello again everyone, I am trying to make a simple bot/AI to help me at work. I need it to read the subject line of emails, open them if a certain subject line is found, and then copy the contents of the said email and paste it in a different program. Can the Autoit outlook UDF help me achieve this? Also, I have tried the Outlook UDF and so far I have only figured out how to find all the unread emails (thanks to one of water's example scripts. @water you are a genius just saying). I am very new to this UDF and would love any help that would guide me into making this bot/AI a reality at work.
-
Hello everyone, I am wondering if and how it is possible to connect my AutoIt script to a different email in my outlook. I have two different accounts when I open outlook. The first which my script always connects to is my own email while the second is a group email account. How or can I make the script connect to the second one and access its inbox instead of mine? This is all work related so no funny business here. Global $oOutlook = _OL_Open() ; Store all the Unread emails into an array Global $aItems = _OL_ItemFind($oOutlook, "*\Outlook-UDF-Test", $olMail, _ "[UnRead]=True", "Subject", "Maintenance Request from Eagle's Nest", "EntryID,Subject", "", 1) ; Display the array of unRead emails If IsArray($aItems) Then ;_ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind - Unread mails") Else MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", _ "Could not find an unread mail. @error = " & @error & ", @extended: " & @extended) EndIf ; Get the number of unread emails Global $numberOfUnRead = UBound($aItems, $UBOUND_ROWS) - 1 ;MsgBox("", "Number of Unread emails", $numberOfUnRead) ConsoleWrite("Number of unread emails: " & $numberOfUnRead & @CRLF) I might be missing some code in the post but my code works It's just so long I don't want to post all 2300+ lines. Thank you for the help I greatly appreciate this community.
-
I had a problem using OutlookEX when automating Outlook v14 (2010) when it was already running; the object returned from _OL_Open wasn't usable . As a test, this example would fail to create an object for $objMail but there was no error from _OL_Open() $outlook = _OL_Open() $objMail = $outlook.Application.CreateItem(0) but this replacement would work: $outlook = ObjCreate("Outlook.Application") $objMail = $outlook.Application.CreateItem(0) and this would fail: $outlook = ObjGet("", "Outlook.Application") $objMail = $outlook.Application.CreateItem(0) So for my own purposes, the "fix" was to just to add a flag for _OL_Open() to ObjCreate() instead of ObjGet() when needed, setting it to True when there's a problem Func _OL_Open($bCreateNew = False, $bWarningClick = False, $sWarningProgram = "", $iWinCheckTime = 1000, $iCtrlCheckTime = 1000, $sProfileName = "", $sPassword = "") If $bCreateNew = Default Then $bCreateNew = False If $bWarningClick = Default Then $bWarningClick = False If $sWarningProgram = Default Then $sWarningProgram = "" If $iWinCheckTime = Default Then $iWinCheckTime = 1000 If $iCtrlCheckTime = Default Then $iCtrlCheckTime = 1000 If $sProfileName = Default Then $sProfileName = "" If $sPassword = Default Then $sPassword = "" Local $oOL = ObjGet("", "Outlook.Application") If IsObj($oOL) Then $__bOL_AlreadyRunning = True If Not IsBool($bWarningClick) Then Return SetError(3, 0, 0) If Not IsInt($iWinCheckTime) Then Return SetError(4, 0, 0) If Not IsInt($iCtrlCheckTime) Then Return SetError(7, 0, 0) If $__bOL_AlreadyRunning And $sProfileName <> "" Then Return SetError(10, 0, 0) ;Specified a profile name to logon to but Outlook is already running. ; Activate the COM error handler for older AutoIt versions If $__iOL_Debug = 0 And (Number(StringReplace(@AutoItVersion, ".", "")) < 3392 Or Number(StringReplace(@AutoItVersion, ".", "")) > 33120) Then _OL_ErrorNotify(4) SetError(0) ; Reset @error which is returned by _OL_ErrorNotify if a COM error handler has already been set up by the user EndIf If Not $__bOL_AlreadyRunning Or $bCreateNew Then $oOL = ObjCreate("Outlook.Application") If @error Or Not IsObj($oOL) Then Return SetError(1, @error, 0) EndIf However, the problem with modifying a UDF is in remembering to apply the same fix for to any update Was there any other "fix" I should have tried before tampering with the UDF? Thanks.
-
Outlook does not allow to import vCard/VCF-files programmatically. I might implement this format (RFC 6350) as I did with the iCalendar data format if someone is interested Please post here or click the "Like" button if you think this is a good idea
-
Hello Friends, I am having a requirement where i have to automate outllook.I have to send mail using outlook.Whe i went through the forum i got OutLookEx.au3 but when i am trying to use this i am getting error can anyone help me in using this? @water
-
Dear members of the forum, I'm working on a project where incoming emails are to be analyzed based on the subject line and moved to various folders in a shared mailbox. I'm using "OutlookEx.au3" of @water. The macro can can move emails to any folder that I newly create. But the macro couldn't move emails to specific folders that are already existing. I checked the permission levels of those folders and found that nothing is wrong with that. The function I use is _OL_ItemMove. Please guide me how to proceed further. Thanks in advance. -Gowrisankar.
-
Good morning everyone, I thought I had already solved this issue but it turns out I did not. My code finds unread emails with this specific subject line of "request" but when I change the subject to SKIPPED + "request" = ("SKIPPED request") the program still finds the email and tries to process it. I only want to process emails with the exact match subject of "request". Here is my code that "finds" the unread emails with the subject of "request" or so I thought. Func ListUnreadEmails() ;******************************************************************************* ; Lists all unread E-mails from the folder Outlook-UDF-Test ;******************************************************************************* ; Stores all the unRead emails into an array Global $aItems = _OL_ItemFind($oOutlook, "*\Outlook-UDF-Test", $olMail, _ "[UnRead]=True", "Subject", "request", "EntryID,Subject", "", 1) ; Displays the array of unRead emails If IsArray($aItems) Then ;_ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind - Unread mails") Else MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", _ "Could not find an unread mail. @error = " & @error & ", @extended: " & @extended) EndIf ; Gets the number of unread emails Global $numberOfUnRead = UBound($aItems, $UBOUND_ROWS) - 1 ;MsgBox("", "Number of Unread emails", $numberOfUnRead) EndFunc It acts as if any part of the subject containing the word "request" and the email is unread that it will try to process it. (I think)
-
Good afternoon, I am in need of some help. I am sure this is a stupid question requiring only one or two lines of code. However, I would greatly appreciate the help I cannot figure this out. I also tried searching for the answer on the internet but no one except me apparently seems to be having a hard time figuring this out and or is asking about it. I simply want to change the "status" of an email from unread to read once I have processed it. My code is over 500 lines and I would like not to clutter this post with it. Assume I have all my includes and connections properly defined and stuff. Here is the bit of code where I am trying to change the email that was used from unread to read: Func ChangeEmailStatus() ;******************************************************************************* ; changes the status of an email from unread to Read ;******************************************************************************* Local $iRows = UBound($aItems, $UBOUND_ROWS) MsgBox("", "Number of Unread emails (Before Change)", $iRows) _OL_ItemModify($oOutlook,$aItems[$i][0], Default, "Read=True") MsgBox("", "Array Display 1", $aItems[1][0]) MsgBox("", "Array Display 2", $aItems[2][0]) Local $iRows = UBound($aItems, $UBOUND_ROWS) MsgBox("", "Number of Unread emails (After Change)", $iRows) EndFunc
-
Dear members of the forum, I need to open the attachments from mails without downloading them. Is it possible using OutlookEx UDF ?
- 41 replies
-
- outlook
- attachments
-
(and 1 more)
Tagged with:
-
Dear members, I'm trying to move unread mails from Inbox to a different folder using OutlookEx UDF. But its not working for me. I'm not sure what mistake I do. I get the error code 6 when the following is executed. From the UDF it is observed that "No or an invalid item has been specified". Note : The UDF version is 1.3.3.1. AutoIt version (v3.3.14.2). #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) Global $aOL_Item = _OL_ItemFind($oOutlook, "*\Inbox", $olMail, "[UnRead]=True", "", "", "Subject", "", 1) If $aOL_Item[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Could not find a task item in folder 'Outlook-UDF-Test\SourceFolder\Tasks'. @error = " & @error) _ArrayDisplay($aOL_Item, "OutlookEX UDF: _OL_ItemFind Example Script - Unread mails") _OL_ItemMove($oOutlook, $aOL_Item[1][0], Default, "*\Outlook-UDF-Test\TargetFolder\Mail") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Error moving specified task. @error = " & @error) Any help is deeply appreciated. Thanks in advance. Thanks and regards, Gowrisankar R.
-
Dear members, I'm trying to get the attachments from mails using OutlookEx UDF and then save them in a particular location. The UDF considers even the signature images and other images in the mail body as attachments, and saves it in the folder I point. I want only the proper attachment documents to be saved. Requesting the guidance of the forum members. Thanks and regards, Gowrisankar R.
-
As the OutlookEX UDF - Help & Support thread has grown too big, I'm starting a new one. The original thread can be found here.
- 817 replies
-
Hi all. Does AutoIt have any functions/tools (either built-in or user defined) that can help me automate the process of exporting an OST mailbox to a PST file in Microsoft Outlook (2013)? I know how to carry out the process manually. At the Microsoft Forums, I have asked if it is possible to do the same via a script, but some have said it is not possible. It may be possible if I was using Microsoft Exchange, but I am not. I've seen some posts about an Outlook UDF on this site (here and here), but I don't see any mention of exporting a mailbox. In my post at the Microsoft Forums, many paid third party applications were suggested. But for now I would like to pursue the custom scripting route as far as I can. The ultimate goal of this exercise is to automatically create a weekly backup of my Outlook mailbox for offline storage. Thanks in advance.
-
Dear members of the forum, I'm new to AutoIt and I'm having a good time exploring and enjoying the features of AutoIt. For one of my tasks, I've to open few particular mails from outlook based on subject of the mails and then print the mails. Can someone please guide me how to do it? My question could be very silly for experts. But I'm just a beginner. Kindly advice. Thanks and regards, Gowrisankar R.
-
I'm writing Outlook pst cleaner and now I'm stuck. Compiled script is crashing with OS crash message. When I tryied to run script from editor it's exiting itself (mabye it's some type of crash?) always when it's processing on 4-rd pst file. Here is my code: #include <OutlookEX.au3> #include <Date.au3> #include <File.au3> #include <Array.au3> _cleanOutlook("Administrator") _cleanOutlook("Admin") Exit Func _cleanOutlook($user) $foldery = "Wiadomości-śmieci#?SPAM#?Junk E-mail#?Elementy usunięte#?Deleted Items" $tab_folderow = StringSplit($foldery, "#?", 1) $tab_pst = _FileListToArrayRec("c:\users\" & $user, "*.pst", 1+4+8, 1, 0, 2) ;~ _ArrayDisplay($tab_pst) For $d = 1 To UBound($tab_pst) -1 Step +1 $outlook = _OL_Open(True) _OL_Close($outlook, True) $outlook = _OL_Open() Local $aStores = _OL_StoreGet($outlook) ;~ _ArrayDisplay($aStores) For $i = 1 to $aStores[0][0] If $aStores[$i][4] = True Then ;~ ConsoleWrite(@CRLF & "zamykam pst 2") _OL_PSTClose($outlook,$aStores[$i][0]) EndIf Next ;~ _OL_PSTAccess($outlook, "C:\Users\Administrator\Desktop\cos.pst") _OL_PSTAccess($outlook, $tab_pst[$d]) ConsoleWrite(@CRLF & $tab_pst[$d]) ;~ $tab_struktury = _OL_FolderTree($outlook, "*", 10) ;~ If @error Then ;~ ContinueLoop ;~ EndIf ;~ _ArrayDisplay($tab_struktury) $tab_ktory_pst = _OL_PSTGet($outlook) ;~ _ArrayDisplay($tab_ktory_pst) For $a = 0 To UBound($tab_ktory_pst) -1 Step +1 If $tab_ktory_pst[$a][2] = $tab_pst[$d] Then ;~ MsgBox(0, "", $tab_ktory_pst[$a][0]) $nazwa_bazy_pst = $tab_ktory_pst[$a][0] EndIf Next ;~ MsgBox(0, "", UBound($tab_folderow)) ;~ _ArrayDisplay($tab_folderow, $tab_pst[$d]) ConsoleWrite(@CRLF & "przed while") $a = 0 While $a < 2 ConsoleWrite(@CRLF & "while 1") For $b = 1 To UBound($tab_folderow) -1 Step +1 ConsoleWrite(@CRLF & "for 1") $tab_struktury = _OL_FolderTree($outlook, $nazwa_bazy_pst) ;~ _ArrayDisplay($tab_struktury, $nazwa_bazy_pst) ;~ $folder = _OL_FolderAccess($outlook, StringTrimLeft($tab_struktury[0], 2) & "\" & $tab_folderow[$b]) $folder = _OL_FolderAccess($outlook, $nazwa_bazy_pst & "\" & $tab_folderow[$b]) ;~ ConsoleWrite(@CRLF & "eeee") If @error Then ;~ MsgBox(0, "", "\\" & $nazwa_bazy_pst & "\" & $tab_folderow[$b] & @CRLF & @error) ConsoleWrite(@CRLF & "przechodze do kolejnego " & $b+1) ContinueLoop EndIf ;~ _ArrayDisplay($folder, $nazwa_bazy_pst) ConsoleWrite(@CRLF & $tab_folderow[$b]) If $tab_folderow[$b] = "Deleted Items" Or $tab_folderow[$b] = "Elementy usunięte" Then ConsoleWrite(@CRLF & "usuwam kosze") _OL_FolderDelete($outlook, $folder[1], 1) _OL_FolderDelete($outlook, $folder[1], 2) _OL_FolderDelete($outlook, $folder[1], 3) _OL_FolderDelete($outlook, $folder[1], 4) ;~ _OL_FolderDelete($outlook, $folder[1], 5) EndIf If $a = 0 Then $tab_maile = "" $data_dzis = @YEAR & "/" & @MON & "/" & @MDAY & " 00:00" ;~ $data_dzis = "2017/01/31 00:00" $data_szukana = _DateAdd("D", "-3", $data_dzis) $tab_maile = _OL_ItemFind($outlook, $folder[1], $olMail, "[Received]<'" & StringReplace($data_szukana, "/", "-") & "'", "", "", "EntryID", "", 1) If @error Then ContinueLoop EndIf ;~ If UBound($tab_maile) > 1 Then ;~ _ArrayDisplay($tab_maile) ;~ EndIf If UBound($tab_maile) > 1 Then For $c = 1 To UBound($tab_maile) -1 Step +1 ;~ ConsoleWrite(@CRLF & "usuwam stare maile") _OL_ItemDelete($outlook, $tab_maile[$c][0], "", False) Next EndIf EndIf Next $a = $a + 1 WEnd ;~ ConsoleWrite(@CRLF & "pokazuje") ;~ $folder[1].Display $olFolderInbox.Display ;~ _OL_PSTClose($outlook, $olFolderInbox) ;~ If @error Then ;~ MsgBox(0, "", @error) ;~ EndIf Local $aStores = _OL_StoreGet($outlook) ;~ _ArrayDisplay($aStores) For $i = 1 to $aStores[0][0] If $aStores[$i][4] = True Then ;~ ConsoleWrite(@CRLF & "zamykam pst 1") _OL_PSTClose($outlook,$aStores[$i][0]) EndIf Next ;_OL_PSTClose($outlook, $folder[1]) _OL_Close($outlook, True) If @error Then MsgBox(0, "", @error) EndIf ConsoleWrite(@CRLF & "zamykam") ProcessWaitClose("outlook.exe", 30) ProcessClose("outlook.exe") Next EndFunc Outlook and OS is updated. I'm usinn OutlooEX in ver. 1.3.1.0 Any ideas?
-
Hi all. I am trying to do 2 things but i cannot seem to get any traction on how to read/implement this idea. Premise: PowerPoint file in C\temp\presentation.pptx that contains on the first slide 2 entries as "<one>" and "<two>" which need to be replaced with "user1" and "user2", then a silent Outlook send mail containing the file with a predefined body and subject. I narrowed it down to COM objects as the Office does not like intrusive open AutoIt functions. I installed OLE/COM Object Viewer to understand how to create the commands but i am still stuck. So far i am trying to user water's code but i suck COM object i was originally trying to modify Dim $oPPT, $oPres $oPPT = ObjCreate("PowerPoint.Application") $oPPT.Visible = True $oPres = $oPPT.Presentations.Read Water's code below (0.1% modified) #include <File.au3> #include "PowerPoint.au3" #include <misc.au3> Global $sFile = "C:\temp\presentation.pptx" Global $sString2Search = "<username>", $sString2Replace = "Password", $iReplaceOnce = 1, $sFullLogFile = "C:\temp\pptxlog.txt" _ProcessPpt($sFile) Func _ProcessPpt($sFile) $oApp = _PPT_PowerPointApp() Local $bChange = False Local $oInterface = $oApp.Presentations Local $oPresentation = $oInterface.Open($sFile, False, False, False) If @error Then _FileWriteLog($sFullLogFile, "E Error " & @error & " opening File " & $sFile) Return SetError(1, 0, 0) EndIf ;it does not even open my file and from here not sure how to read the text and replace it EndFunc ;==>_ProcessPpt
-
Anyony interested in a function to retrieve the Outlook mailbox quotas for Exchange mailboxes? If yes, then this function could be added to the OutlookEX UDF. Result could look like (will later be returned in an array):
-
Through below script I am able to send mail with the Outlook installed in my machine. But I am getting below prompt whenever I ran this script,by Outlook. Can anyone suggest how to suppress this. #include <MsgBoxConstants.au3> ; Counting the number of open shell windows Local $oShell = ObjCreate("Outlook.Application") ; Get the Windows Shell Object If IsObj($oShell) Then $Mail = $oShell.CreateItem(0) $Mail.To = "dponnada@erwin.com" $Mail.Subject = "Action" $Mail.Body ="Pay rise please" $Mail.Send() EndIf