water Posted August 5, 2011 Author Share Posted August 5, 2011 @Mercury049 The problem you have seen is caused by the COM error handler established in function _AD_Open by the AD UDF. When you call _OL_Open it tries to establish it's own COM error handler. But as the Active Directory COM error handler is still active the Outlook UDF can't. Now we get a COM error in the Outlook UDF which then is handled by the AD COM error handler. I have to investigate why we get the Outlook COM error at all. This problem can be prevented by _AD_Close (as you did) or by changing the call to _OL_Wrapper_Sendmail to: _OL_Wrapper_SendMail($oOutlook, "joe.blow@email.com", "", "", "DO NOT REPLY - TEST MESSAGE", $strEmailBody, "", $olFormatPlain) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted August 7, 2011 Author Share Posted August 7, 2011 Version 0.4.0 has been released.Please test before using in production!For download please see my signature. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Dschingis Posted August 22, 2011 Share Posted August 22, 2011 Hi Water, many thanks for your UDF. Its a great tool. But i'm missing one thing and cannot find it in 0.3.0 and 0.4.0. How do i get a listing of all items contained in one single folder? Such a function like _ol_ItemList($oOL,$olFolder)? Did i have to use _OL_ItemFind (which is the only function that seems to cover this point)? All *List functions available only covers addresses and distribution lists. Regards, Thomas Link to comment Share on other sites More sharing options...
water Posted August 22, 2011 Author Share Posted August 22, 2011 (edited) Hi Dschingis, you are correct. The _OL_ItemFind function is what you need. Unfortunately you have to specify the objectclass you want to get listed. If a folder type can hold multiple objectclasses (a contact folder can hold contacts and distribution lists) you have to call _OL_ItemFind twice. This is true because every objectclass has a different set of properties. So to search for or return properties the objectclass has to be specified. Edited August 22, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Dschingis Posted August 23, 2011 Share Posted August 23, 2011 Hi Water, many thanks for your answer. It cost me a bit time to bite me through but now i had a breakthrough. With the line $aItems = _OL_ItemFind($oOutlook, "*", $olMail, "", "", "", "SenderName,Subject,Body,ReceivedTime", "", 1) which i took and modified from your ItemFind example i am able to list the whole complete default folder (my Mailbox) and show me every mail there. Now i am working on changing that to my personal folders as well. I will come back to you with more questions . Thomas Link to comment Share on other sites More sharing options...
water Posted August 23, 2011 Author Share Posted August 23, 2011 ... It cost me a bit time to bite me through but now i had a breakthrough ...Hi Dschingis,If you need more documentation or better/more examples please tell me and I will do my very best to enhance the UDF. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Dschingis Posted August 24, 2011 Share Posted August 24, 2011 Hi Water, many thanks for your offer. I will take you by your word. Here is a new point i stumpled upon. While working with the _OL_FolderTree and _OL_ItemFind functions on Windows XP and Office 2007 i discovered i cannot use the total path delivered by _OL_FolderTree to access Outlook folders. Instead i had to cut the leading two backslashes to get it to work. According to your documentation in OutlookEx.au3 UDF this should make no difference in _OL_FindItem. Any ideas? Global $oOutlook = _OL_Open(),$array1,$array2,$i $array1= _OL_FolderTree($oOutlook, "*") If IsArray($array1) Then _ArrayDisplay($array1,"Folderlist") For $i = 1 to UBound($array1) - 1 $array2 = _OL_ItemFind($oOutlook, CutFirstTwoChars($array1[$i]), $olMail, "", "", "", "EntryID,SenderName,Subject,CreationTime", "", 4) If IsArray($array2) Then _ArrayDisplay($array2, "Mails in Folder " & CutFirstTwoChars($array1[$i])) Else ConsoleWrite("Folder " & CutFirstTwoChars($array1[$i]) & " contains " & $array2 & " mail items." & @LF) EndIf Next EndIf Func CutFirstTwoChars($a) ; Return $a Return StringRight($a,StringLen($a) - 2) EndFunc Link to comment Share on other sites More sharing options...
water Posted August 24, 2011 Author Share Posted August 24, 2011 (edited) Hi Dschingis,according to the description in _OL_FolderAccess (which is called by _OL_ItemFind under the covers) the folderpath you get from _OL_FolderTree is used to access a "subfolder of the default folder of another user (class specified by $iOL_FolderType)".You can shorten the removal of the first 3 characters to "StringMid($array1[$i]), 3)".It looks like this was a bad design decision so the folderpath can not directly be used.Now it is:"\\firstname name\subfolder\...\subfolder" subfolder of the default folder of another user (class specified by $iOL_FolderType)"\\firstname name\\subfolder\...\subfolder" subfolder of another userShould we change it to:"\\firstname name\\subfolder\...\subfolder" subfolder of the default folder of another user (class specified by $iOL_FolderType)"\\firstname name\subfolder\...\subfolder" subfolder of another userHow many scripts would this break? Edited August 24, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Dschingis Posted August 25, 2011 Share Posted August 25, 2011 Oh, i've started an avalanche It looks like this was a bad design decision so the folderpath can not directly be used.Water, i am sure this UDF had grown over a long time so some changes in design are normal Imho every function which uses paths should use the same format. As here the path delivered by FolderTree should be directly usable for all and every function. The path returned by i.e. [mailitemobject].Parent should also be usable in ItemMove, etc. If different path formats are necessary for the objects the wrapper should take care of that, i.e. converting them from one format to another. Should we change it to:I am used to the path designs of Windows and Un*x so i am tending to prefer the design where \\ means the root of every mailbox or container. So any path should start with either an * or a double backslash and my favorite is \\firstname name\top-level-subfolder\subfolder\..\..\.. for basic access to any folder regardless of me or another user. When i read the docs i understand * (a star char) is equivalent to \\MyFirstName MyName which is my own root folder, i.e. i can use *\ClusterInfo for one top level subfolder of my own mailbox. In general i'd be happy with absolute paths for all and every occasion. Any comments? Link to comment Share on other sites More sharing options...
water Posted August 25, 2011 Author Share Posted August 25, 2011 Oh, i've started an avalanche No, just a design discussion.Water, i am sure this UDF had grown over a long time so some changes in design are normal We started to work on this UDF in march. It's a complete rewrite of the existing Outlook UDF. Therefore the name was changed to OutlookEX (for extended).Imho every function which uses paths should use the same format. As here the path delivered by FolderTree should be directly usable for all and every function.D'accord. To make the format returned by folderpath work for every function I need to change the way a path is interpreted.I will change the meaning of the second \\ (marked in red in my previous post). All functions use a folder object to access the folder which is returned by _OL_FolderAccess. _OL_FolderAccess itself interprets the foldername you specify as paramter. This interpretation will be changed so folderpaths will work the way you woul like it to work.I hope this doesn't break too many scripts!I'm on vacation for at least one week and will think about it with a glass of french red wine in one and some of the local food in the other hand My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Jaboowaki Posted August 31, 2011 Share Posted August 31, 2011 (edited) Hello, I am currently working with a modified Outlook.au3 and ran across your UDF. I am stumped on deleteing a contact. Can anyone give me an example of how this UDF does that? Thanks... Okay, I figured it out myself, with this awesome UDF... #include <OutlookEX.au3> $oOL = _OL_Open() Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderContacts) $varArray = _OL_ItemFind( $oOL, $aFolder[1], $olContact, '[FullName] = "John Doe"', "", "", "EntryID") _OL_ItemDelete($oOL, $varArray[1][0], "") Edited August 31, 2011 by Jaboowaki Link to comment Share on other sites More sharing options...
Sundance Posted September 7, 2011 Share Posted September 7, 2011 Hi water, we are currently changing from outlook2003 to 2010 and there are many users who have pst files in use. Is there a way to add a pst file to the new created 2010 profile? So when the user starts outlook 2010 the first time he has directly all the old pst files from his outlook 2003. Is there some kind of 'object' to accomplish this task? thx in advance Sundance from cloudy germany Link to comment Share on other sites More sharing options...
water Posted September 7, 2011 Author Share Posted September 7, 2011 Yes, _OL_PSTAccess should do what you need. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Sundance Posted September 9, 2011 Share Posted September 9, 2011 Ups. I totally overlooked this. Gonna give it a try. Thank you!! Link to comment Share on other sites More sharing options...
Sundance Posted September 9, 2011 Share Posted September 9, 2011 Nice. Tested it. It opens Outlook, adds the pst and closes it. If Outlook is allready open then it adds the pst directly. Nicely done and great work !!!! Happy weekend Sundance Link to comment Share on other sites More sharing options...
water Posted September 9, 2011 Author Share Posted September 9, 2011 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Jaboowaki Posted September 9, 2011 Share Posted September 9, 2011 How would you search for a contact by CompanyName and FullName? $aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "", "CompanyName,FullName", $CompanyName&","&$FullName, "EntryID" ) does not work.... how else do I write that statement? Link to comment Share on other sites More sharing options...
water Posted September 11, 2011 Author Share Posted September 11, 2011 (edited) How would you search for a contact by CompanyName and FullName? $aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "", "CompanyName,FullName", $CompanyName&","&$FullName, "EntryID" )The _OL_ItemFind.html file provided with the ZIP file explains how to create a query. $aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CompanyName]='Name of the Company' And [FullName]='Fullname you search for'", "", "", "EntryID" ) I think the Wiki needs an extended description and some good examples Edited September 11, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
jaideept Posted September 14, 2011 Share Posted September 14, 2011 hello Every one, please let us know how to read outlook email using outlookEx.au3? Thanks, Jaideep Link to comment Share on other sites More sharing options...
water Posted September 14, 2011 Author Share Posted September 14, 2011 What do you mean by "read"? Find a mail filtered by subject, sender or whatever? Display a mail? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts