water Posted March 18, 2015 Author Share Posted March 18, 2015 Will post the workaround tomorrow. This is the fixed _OL_ItemRecipientAdd function: expandcollapse popupFunc _OL_ItemRecipientAdd($oOL, $vItem, $sStoreID, $iType, $vP1, $vP2 = "", $vP3 = "", $vP4 = "", $vP5 = "", $vP6 = "", $vP7 = "", $vP8 = "", $vP9 = "", $vP10 = "", $bAllowUnresolved = True) Local $oRecipient, $aRecipients[10], $oTempRecipient If Not IsNumber($iType) Then Return SetError(5, 0, 0) If Not IsObj($vItem) Then If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0) $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID) If @error Then Return SetError(2, @error, 0) EndIf ; Move members into an array If Not IsArray($vP1) Then $aRecipients[0] = $vP1 $aRecipients[1] = $vP2 $aRecipients[2] = $vP3 $aRecipients[3] = $vP4 $aRecipients[4] = $vP5 $aRecipients[5] = $vP6 $aRecipients[6] = $vP7 $aRecipients[7] = $vP8 $aRecipients[8] = $vP9 $aRecipients[9] = $vP10 Else $aRecipients = $vP1 EndIf ; add recipients to the item #forceref $oTempRecipient ; to prevent the AU3Check warning: $oTempRecipient: declared, but not used in func. For $iIndex = 0 To UBound($aRecipients) - 1 ; recipient is an object = recipient name already resolved If IsObj($aRecipients[$iIndex]) Then $oTempRecipient = $vItem.Recipients.Add($aRecipients[$iIndex]) If @error Then Return SetError(300 + $iIndex, @error, 0) $oTempRecipient.Type = $iType Else If StringStripWS($aRecipients[$iIndex], 3) = "" Then ContinueLoop $oRecipient = $oOL.Session.CreateRecipient($aRecipients[$iIndex]) If @error Or Not IsObj($oRecipient) Then Return SetError(600 + $iIndex, @error, 0) $oRecipient.Resolve If @error Or Not $oRecipient.Resolved Then If Not (StringInStr($aRecipients[$iIndex], "@")) Or Not ($bAllowUnresolved) Then Return SetError(400 + $iIndex, @error, 0) EndIf $oTempRecipient = $vItem.Recipients.Add($oRecipient) If @error Then Return SetError(300 + $iIndex, @error, 0) $oTempRecipient.Type = $iType EndIf Next $vItem.Save() Return $vItem EndFunc ;==>_OL_ItemRecipientAdd My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
secman Posted March 19, 2015 Share Posted March 19, 2015 Glad you like the UDF You are sending userids and passwords by mail? From a security view not a very good idea. You either need to search for the mail item by subject, date etc. or wait for the event which is generated when a new mail arrives. Thanks for the help Water, I will probably be sending the username and password separately but I have little choice as my "customers" are worldwide! I can work out how to search for the message no problem but how do I actually read the message to enable me to extract the info I want. Is it possible to export the body of the message to a file or array and then search that (using _OL_ItemExport)? It is not clear from the examples if this is possible. Sorry to be a bit thick on this but it is all very new to me and I obviously don't quite get how Outlooks works at the moment I will look through the Wiki pages again later. Many thanks Alan Link to comment Share on other sites More sharing options...
water Posted March 19, 2015 Author Share Posted March 19, 2015 Use _OL_ItemFind to retrieve a list of mail items. You need to pass search parameters which identify the mails you cant to process (subject, sender etc.). Retrieve the EntryID for this items and then use _OL_ItemGet to retrieve the "Body" property. Example 1 in _OL_ItemGet.au3 shows what I mean. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
secman Posted March 19, 2015 Share Posted March 19, 2015 Many thanks once again, I will have a look and see what I can sort out. Alan Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 20, 2015 Share Posted March 20, 2015 (edited) Running into some strange Challenges when running a compiled Autoit Script in Task Scheduler that uses the Outlook UDF. The Compiled executable works fine when you manually click on the EXE to run it , when its scheduled in Task Scheduler It fails on the Global $oOutlook = _OL_Open() and reports an error of -2147221164 which is a class unregistered. I tried doing a repair on office install and that did not help , using office 2013 I'm running this on Windows 8 , the task has the properties set to run with the highest Privileges below is the snippet of the code that applies to using the UDF #include <D:UsersPaul SchraderDocumentsAutoit ScriptsOutlook_1.0.0.0OutlookEX.au3> Global $oOutlook = _OL_Open() MsgBox(4096,"err",@extended & "/" & @error) Any Suggestions on what to try Edited March 20, 2015 by HighlanderSword Link to comment Share on other sites More sharing options...
water Posted March 20, 2015 Author Share Posted March 20, 2015 Looks like the class has not been registered for the user that runs the scheduled task. Or maybe this section in the wiki helps. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 20, 2015 Share Posted March 20, 2015 It's the same user that Manually run's the executable that has the issue when the task is scheduled, using the same user id when it scheduled. Tried running it with Admin Privs as well no change Link to comment Share on other sites More sharing options...
DOTCOMmunications Posted March 27, 2015 Share Posted March 27, 2015 Hi We have an exchange 2010 server configured as our only accounts in Outlook but have access to a shared mailbox and have send permission from that mailbox as well, how would we go about creating an e-mail from that address? e.g. adam@dot-communications is my main address but want to send from shared mailbox info@dot-communications instead Thanks in advance Adam Link to comment Share on other sites More sharing options...
water Posted March 27, 2015 Author Share Posted March 27, 2015 Please have a look at the OutlookEX wiki. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 30, 2015 Share Posted March 30, 2015 ok , my issue with Scheduling the task was some how related to it could not attach to the already open outlook session, so I modified the script to check and see if outllook is running , and if so close it out. The Process then works fine from that point on Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 30, 2015 Share Posted March 30, 2015 (edited) When using the function _OL_Wrapper_SendMail to send email it has issues sometimnes resolving the email address, I'm using this on outlook 2013 and have also tried outllok 2010. I'm passing in the full smtp email address (jane.doe@emailladd.com) and the function returns and error code of 6002. Using UDF Version ...: 0.10.0.0 I then manually pasted the same smtp email addrfess into outlook and it resolved it with no issues. Looks like it's having issues resolving against other Jane.Doe in the Exchange server when running via the udf. the smtp email address's for the other Jane.Doe's are not the same as the one im using. Any ideas what I should try Edited March 30, 2015 by HighlanderSword Link to comment Share on other sites More sharing options...
water Posted March 30, 2015 Author Share Posted March 30, 2015 _OL_Wrapper_SendMail has limited functionality and error checking. So when you paste the address into Outlook you do not get the dialog that the address resolves to multiple users? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 30, 2015 Share Posted March 30, 2015 Nope it resolves the SMTP email address to the correct person Link to comment Share on other sites More sharing options...
water Posted March 30, 2015 Author Share Posted March 30, 2015 Strange. Error 6002 is being returned by _OL_ItemSend. Can you post the line where you call _OL_Wrapper_SendMail (replace confidential data with *** where needed)? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 30, 2015 Share Posted March 30, 2015 Hello, Below are the details. _OL_Wrapper_SendMail($oOutlook, "********" & ";" & "*******", "*****", "", "CRQ Updates Required", $CrqBody, "",$olFormatHTML, $olImportanceNormal) It saves the email in my Drafts folder and has the person it cant resolve flagged as such, however the email address is not the SMTP one I provided, its the users name , So for example Jane.Doe@email.com, will now show as Doe, Jane and be flagged as red indicating it wasnt resolved. Link to comment Share on other sites More sharing options...
water Posted March 30, 2015 Author Share Posted March 30, 2015 Jane.Doe is in the To or CC field? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 30, 2015 Share Posted March 30, 2015 In the CC, also tried in the To does the same Link to comment Share on other sites More sharing options...
water Posted March 30, 2015 Author Share Posted March 30, 2015 What do you get if you check the recipient using the following code: Global $aResult = _OL_ItemRecipientCheck($oOutlook, "Jane.Doe@email.com") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error checking recipients. @error = " & @error & ", @extended: " & @extended) _ArrayDisplay($aResult) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted March 30, 2015 Share Posted March 30, 2015 (edited) Hello, It displays the user fullq qualified email in Column 1,4 Column 2 displays True Column 3 is Blank Column 5 = 0 Column 6 = User Human name Doe,Jane Edited March 30, 2015 by HighlanderSword Link to comment Share on other sites More sharing options...
water Posted March 30, 2015 Author Share Posted March 30, 2015 You mean the columns labeled with "Col n"? Col 0: Jane.Doe@email.com Col 1: True Col 2: Col 3: Col 4: Jane.Doe@email.com Col 5: 0 Col 6: Doe, Jane My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts