water Posted April 23, 2012 Author Share Posted April 23, 2012 (edited) Is _OL_Close($oOutlook) absolutely necessary if the user will send the email manually? It seems to work fine without it.Outlook is not running:_OL_Open starts Outlook and connects to the instance. _OL_Close closes the connection to Outlook and Outlook is ended.Outlook is already running:_OL_Open connects to the running instance. _OL_Close closes the connection to Outlook but Outlook remains running. You can call _OL_Open with parameter $bOL_ForceClose = True to intentionaly end Outlook.Variable $bOL_AlreadyRunning is set to True if Outlook was already running when _OL_Open was called.In your case you can omit _OL_Close because the necessary cleanup is done when the script exits. Edited April 23, 2012 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...
SkoubyeWan Posted April 23, 2012 Share Posted April 23, 2012 Okay. Great. Thanks. On a different topic. I have been looking at the _OL_Example_NewMail_Event.au3 script you supplied. The code here is well over my head. But I want to do something similar but when an email is sent. That is, when the user sends an email a dialog comes up allow them to save the email just sent to a specified folder. I tried modifying the "Default" from your script thinking that it was watching for a new item in a specified folder, but that did not seem to work. Any leads you can give me would be greatly appreciated. SkoubyeWan Link to comment Share on other sites More sharing options...
water Posted April 23, 2012 Author Share Posted April 23, 2012 SkoubyeWan, something to play with: #AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y #include <OutlookEX.au3> ; ***************************************************************************** ; Example Script ; Handle Outlook ItemSend event when an item is sent. ; This script loops until Shift-Alt-E is pressed to exit. ; ***************************************************************************** HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!") Global $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") While 1 WEnd ; Outlook 2007 - ItemSend event - http://msdn.microsoft.com/en-us/library/bb147641%28v=office.12%29.aspx Func oOApp_ItemSend($sOL_ItemObject, $bOL_Cancel) MsgBox(64, "OutlookEX UDF Example Script", "New item has been sent!" & @CRLF & @CRLF & _ "Subject: " & $sOL_ItemObject.Subject) EndFunc ;==>oOApp_NewMailEx Func _Exit() Exit EndFunc ;==>_Exit 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 April 23, 2012 Author Share Posted April 23, 2012 (edited) I should mention that it only seems to affect the wrapper function.Strange. Because the wrapper function only uses functions from the UDF:_OL_ItemCreate, _OL_ItemModify, _OL_ItemRecipientAdd, _OL_ItemAttachmentAdd and _OL_ItemSend Edited April 23, 2012 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...
mdcastle Posted April 23, 2012 Share Posted April 23, 2012 water - would you mind having a look at this snippet and letting me know where i'm going wrong? When I run it there is no error output to the Console, but the item is not moved as expected. ;Get year and month for correct folder $YearMon = @YEAR & "-" & @MON ;Move all items from 'Invoices sent to DCS' to correct month folder Global $aFolder3 = _OL_FolderAccess($oOutlook, "Correct MailboxInboxInvoices sent to DCS", $olFolderInbox) If @error <> 0 Then Exit MsgBox(16, "Error accessing folder", "Error accessing folder 'Invoices sent to DCS'. @error = " & @error) Global $aFolder2 = _OL_FolderAccess($oOutlook, "Correct MailboxInboxInvoices Sent to DCS" & $YearMon, $olFolderInbox) If @error <> 0 Then Exit MsgBox(16, "Error accessing folder", "Error accessing correct 'year-month' folder. @error = " & @error) ; Get items Global $aItems1 = _OL_ItemFind($oOutlook, $aFolder3[1], $olMail, "", "", "", "EntryID,Subject,Body") If @error <> 0 Then Exit MsgBox(16, "Item find", "Error searching for read mail items. @error = " & @error & ", @extended = " & @extended) ;Error if no read emails to send If $aItems1[0][0] = 0 Then Exit MsgBox(16, "Error", "No mail items in 'Invoices Sent to DCS' folder.") For $i = 1 To $aItems1[0][0] $oMove = _OL_ItemMove($oOutlook, $aItems[$i][0], $aFolder3[4], $aFolder2[1]) Next Many thanks in advance. Link to comment Share on other sites More sharing options...
water Posted April 23, 2012 Author Share Posted April 23, 2012 Please modify your code like this: ;Get year and month for correct folder $YearMon = @YEAR & "-" & @MON ;Move all items from 'Invoices sent to DCS' to correct month folder Global $aFolder3 = _OL_FolderAccess($oOutlook, "\\Correct Mailbox\Inbox\Invoices sent to DCS", $olFolderInbox) If @error <> 0 Then Exit MsgBox(16, "Error accessing folder", "Error accessing folder 'Invoices sent to DCS'. @error = " & @error) Global $aFolder2 = _OL_FolderAccess($oOutlook, "\\Correct Mailbox\Inbox\Invoices Sent to DCS\" & $YearMon, $olFolderInbox) If @error <> 0 Then Exit MsgBox(16, "Error accessing folder", "Error accessing correct 'year-month' folder. @error = " & @error) ; Get items Global $aItems1 = _OL_ItemFind($oOutlook, $aFolder3[1], $olMail, "", "", "", "EntryID,Subject,Body") If @error <> 0 Then Exit MsgBox(16, "Item find", "Error searching for read mail items. @error = " & @error & ", @extended = " & @extended) ;Error if no read emails to send If $aItems1[0][0] = 0 Then Exit MsgBox(16, "Error", "No mail items in 'Invoices Sent to DCS' folder.") For $i = 1 To $aItems1[0][0] $oMove = _OL_ItemMove($oOutlook, $aItems[$i][0], $aFolder3[3], $aFolder2[1]) If @error <> 0 Then MsgBox(16, "Item move", "Error moving item. @error = " & @error & ", @extended = " & @extended) Next 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...
SkoubyeWan Posted April 23, 2012 Share Posted April 23, 2012 SkoubyeWan, something to play with: #AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y #include <OutlookEX.au3> ; ***************************************************************************** ; Example Script ; Handle Outlook ItemSend event when an item is sent. ; This script loops until Shift-Alt-E is pressed to exit. ; ***************************************************************************** HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!") Global $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") While 1 WEnd ; Outlook 2007 - ItemSend event - http://msdn.microsoft.com/en-us/library/bb147641%28v=office.12%29.aspx Func oOApp_ItemSend($sOL_ItemObject, $bOL_Cancel) MsgBox(64, "OutlookEX UDF Example Script", "New item has been sent!" & @CRLF & @CRLF & _ "Subject: " & $sOL_ItemObject.Subject) EndFunc ;==>oOApp_NewMailEx Func _Exit() Exit EndFunc ;==>_Exit This is great! I had to remove the parameters for the function to Func oOApp_ItemSend(). It caused the script to crash, but with that done it does exactly what I was hopeing. It triggers when an email is sent. Now I need to work on using _OL_ItemFind to find the most recently sent email's information so I can act upon it. I will have to play with that and search a bit. Thanks Water. SkoubyeWan Link to comment Share on other sites More sharing options...
water Posted April 23, 2012 Author Share Posted April 23, 2012 _OL_ItemFind only allows one restrict and/or one search parameter. If you need more you could try the beta of _OL_ItemSearch. Here you can enter a very complex DASL query. 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...
SkoubyeWan Posted April 23, 2012 Share Posted April 23, 2012 What I am really trying to accomplish is find the most recently sent email in the "Sent Item" folder. What would I use in _OL_ItemFind to search for this. SkoubyeWan Link to comment Share on other sites More sharing options...
water Posted April 23, 2012 Author Share Posted April 23, 2012 Can't test at the moment. But I think you just need to retrieve all mail items from the "Sent Item" folder (means: don't specify a restrict or find parameter). The entries are ordered by EntryID which means the last sent item should be the last item in the array (please verify). If not I can have a look at it tomorrow. 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...
SkoubyeWan Posted April 23, 2012 Share Posted April 23, 2012 Can't test at the moment. But I think you just need to retrieve all mail items from the "Sent Item" folder (means: don't specify a restrict or find parameter). The entries are ordered by EntryID which means the last sent item should be the last item in the array (please verify).If not I can have a look at it tomorrow.Water:I have verified that you are correct. The last item in the array is the last item sent.You have been most generous. I will post my final code when completed so that others may use it and improve on it.Thanks again.SkoubyeWan Link to comment Share on other sites More sharing options...
water Posted April 23, 2012 Author Share Posted April 23, 2012 Glad I could help to improve your script. Such real life problems often lead to improvements of the UDF. That's one of the reasons why I'm glad to help - it's of use for others too! 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...
SkoubyeWan Posted April 24, 2012 Share Posted April 24, 2012 Glad I could help to improve your script. Such real life problems often lead to improvements of the UDF. That's one of the reasons why I'm glad to help - it's of use for others too! Well here is my script. It needs a lot of polishing, but it works. This script captures the ItemSend event when an email is sent and allows the user to save the email to the hard drive and then to archive it in a specified folder. I hope this is useful to someone else. Couldn't have done it without Water's help. expandcollapse popup#AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y #include <OutlookEX.au3> #include <Array.au3> ; ***************************************************************************** ; Example Script ; Handle Outlook ItemSend event when an item is sent allowing the item to be saved in msg format to the hard drive and then moved to an archive folder. ; This script loops until Shift-Alt-E is pressed to exit. ; ***************************************************************************** HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!") Global $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") Global $var = "" Global $SaveEmail While 1 WEnd ;~ ; Outlook 2007 - ItemSend event - http://msdn.microsoft.com/en-us/library/bb147641%28v=office.12%29.aspx Func oOApp_ItemSend() $SaveEmail = MsgBox(4, "TMR - Save Sent Email", "Do you want to Save the Email?") If $SaveEmail = "6" Then Sleep(2000) Global $oOutlook = _OL_Open() $aItems = _OL_ItemFind($oOutlook, "*Sent Items", $olMail, "", "", "", "EntryID", "", 1) $var = FileSelectFolder("Select the location to save to", "h:") Global $aOL_Properties = _OL_ItemGet($oOutlook, $aItems[$aItems[0][0]][0]) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemGet Example Script", "Error accessing properties. @error = " & @error) _OL_ItemSave($oOutlook, $aItems[$aItems[0][0]][0], Default, $var & "" & "EML.SUBJECT-" & $aOL_Properties[74][1] & ".SENDER-" & $aOL_Properties[66][1] & ".TO-" & $aOL_Properties[80][1] & ".RECEIVED-" & $aOL_Properties[51][1] & ".", $olMSG) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_Itemsave", "Error saving specified emails. @error = " & @error & ", @extended = " & @extended) _OL_ItemMove($oOutlook, $aItems[$aItems[0][0]][0], Default, "*TMR - Sent and Saved") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove", "Error moving specified emails. @error = " & @error) EndIf EndFunc ;==>oOApp_ItemSend Func _Exit() Exit EndFunc ;==>_Exit Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 I think your script can be enhanced and performance can be improved.There is no need to open Outlook in function oOApp_ItemSend and then search all sent items. The item that just has been sent is passed as parameter to the function.Now I understand what you meant byI had to remove the parameters for the function to Func oOApp_ItemSend(). It caused the script to crashI will come up with an improved version quite soon. 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 April 24, 2012 Author Share Posted April 24, 2012 (edited) SkoubyeWan, here is the enhanced version (untested). It could be enhanced further so that _OL_ItemGet doesn't return all properties of the mail item but just the few you need. This has the advantage that your script will run with future versions of Outlook - just in case that the number of the properties and hence the position in the array changes. I get the following properties (Outlook 2010/Exchange 2010): 51 - ReceivedOnBehalfOfEntryID 66 - RTFBody 74 - Sensitifity 80 - Subject expandcollapse popup#AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y #include <outlookex.au3> #include <array.au3> ; ***************************************************************************** ; Example Script ; Handle Outlook ItemSend event when an item is sent allowing the item to be saved in msg format to the hard drive and then moved to an archive folder. ; This script loops until Shift-Alt-E is pressed to exit. ; ***************************************************************************** HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!") Global $oOApp = ObjCreate("Outlook.Application") Global $oEvent = ObjEvent($oOApp, "oOApp_") Global $sFolder = "", $iSaveEmail, $aOL_Properties While 1 WEnd ;~ ; Outlook 2007 - ItemSend event - http://msdn.microsoft.com/en-us/library/bb147641%28v=office.12%29.aspx Func oOApp_ItemSend($sOL_ItemObject, $bOL_Cancel) #forceref $bOL_Cancel $iSaveEmail = MsgBox(4, "TMR - Save Sent Email", "Do you want to Save the Email?") If $iSaveEmail = 6 Then $sFolder = FileSelectFolder("Select the location to save to", "h:") If @error <> 1 Then ; User cancels/closes the file selection window $aOL_Properties = _OL_ItemGet($oOApp, $sOL_ItemObject) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemGet Example Script", "Error accessing properties. @error = " & @error & ", @extended = " & @extended) _OL_ItemSave($oOApp, $sOL_ItemObject, Default, $sFolder & "" & "EML.SUBJECT-" & $aOL_Properties[74][1] & ".SENDER-" & $aOL_Properties[66][1] & ".TO-" & $aOL_Properties[80][1] & ".RECEIVED-" & $aOL_Properties[51][1] & ".", $olMSG) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_Itemsave", "Error saving specified emails. @error = " & @error & ", @extended = " & @extended) _OL_ItemMove($oOApp, $sOL_ItemObject, Default, "*TMR - Sent and Saved") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove", "Error moving specified emails. @error = " & @error & ", @extended = " & @extended) EndIf EndIf EndFunc ;==>oOApp_ItemSend Func _Exit() Exit EndFunc ;==>_Exit Edited April 24, 2012 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...
mdcastle Posted April 24, 2012 Share Posted April 24, 2012 me again! I'm now trying to identify emails with attachments other than PDFs. I've started with _OL_ItemFind, but not got very far! Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, "?what goes here?", "", "", "EntryID,Subject,Body,?Something else here?") I've enclosed the bits i'm not sure about in '??' Any help would be appreciated. Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 Unfortunately you can't get a list of all mail items with an attachment using _OL_ItemFind.I have a beta version of _OL_ItemSearch available that should do what you want.If you want to try I have to test in advance - should I? 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...
mdcastle Posted April 24, 2012 Share Posted April 24, 2012 I have a beta version of _OL_ItemSearch available that should do what you want.If you want to try I have to test in advance - should I?That would be brilliant. thanks. Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 This example script gives you an array listing all mail items of the inbox with at least one attachment: 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...
mdcastle Posted April 24, 2012 Share Posted April 24, 2012 (edited) Thanks. I've changed $sFilter = "@SQL=(""urn:schemas:httpmail:hasattachment"" = 1)" to $sFilter = "@SQL=(""urn:schemas:httpmail:attachmentfilename"" not like '%.pdf%')" but i'm getting error code 13, however there are pdf attachments in the folder. I presume therefore that my query is incorrect. Edited April 24, 2012 by mdcastle Link to comment Share on other sites More sharing options...
Recommended Posts