satanico64 Posted January 9, 2014 Share Posted January 9, 2014 (edited) Hi people ! How are you ? well ? goood here we go : In december I've made a script based on Outlook Ex UDF, and i've got a problem. My script list mails from outlook between 2 dates, and this worked well. But with this new year, i'v got a bug, when the day is between the 1 and the 9 of the month. ALL is detailled in my .au3 joined or code. Example which is working: $listofmailInbox = _OL_ItemFind($oOutlook, $Folder[1], $olMail, "[ReceivedTime]>'2013-12-26 10:00' And [ReceivedTime]<'2014-01-07 16:59'", "", "", "ConversationTopic,SenderName,CreationTime,Body,EntryID", "CreationTime,True", 1) => Search between 2013-12-26 and 2014-01-07 all is ok, i've got hundreds of result. in my array. But when my first date is 2014-01-02 this script doesnt match anything. I just change the number of the date: THIS DOESNT WORK: (same thing as above except date). $listofmailInbox = _OL_ItemFind($oOutlook, $Folder[1], $olMail, "[ReceivedTime]>'2014-01-02 10:00' And [ReceivedTime]<'2014-01-07 16:59'", "", "", "ConversationTopic,SenderName,CreationTime,Body,EntryID", "CreationTime,True", 1) During creation of my script i wanted to check during 5 days, so i was doing @MDAY - 5 If @mday = 09 then @mday - 5 give 4 (and not 04). I thought first it was the problem, but forcing the date with number, as in my script it just doesnt work. (many include, and variable in my code because i reduced it to post) Code: expandcollapse popup#include <GUIConstantsEx.au3> #include <ListviewConstants.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <OutlookEX.au3> #include <GuiEdit.au3> #include <Constants.au3> #include <Array.au3> Global $TrayTooltip, $DOSSIER_Outlook, $Nombredejours, $OptionNotifTempsReel, $date, $hListView = -9999, $hZoneDeTexte = -9999, $hGUI = -9999, $LabCas = 0, $LabOuvrirMail = 0 Global $oMyError = ObjEvent("AutoIt.Error", "_ErrorHTTP"); Interception des erreurs autoit !! Global $oOutlook, $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") Global $listofmail, $listofmailInbox ; While 1 Listes_mails() Exit Sleep(100) WEnd Func Listes_mails() ConsoleWrite("Listes_mails() " & @crlf ) Local $Folder Local $oOutlook = _OL_Open() $Folder = _OL_FolderAccess($oOutlook, "", $olFolderInbox) ; THIS REQUEST IS OK: $listofmailInbox = _OL_ItemFind($oOutlook, $Folder[1], $olMail, "[ReceivedTime]>'2013-12-26 10:00' And [ReceivedTime]<'2014-01-07 16:59'", "", "", "ConversationTopic,SenderName,CreationTime,Body,EntryID", "CreationTime,True", 1) ConsoleWrite("Size of array: Ubound($listofmailInbox):" & UBound($listofmailInbox) & "||" & UBound($listofmailInbox,2) & @crlf ) ;~ _ArrayDisplay($listofmailInbox) ; Uncomment to display result. ;~ msgbox(1,"","Just to make a pause between requests") $listofmailInbox = ''; reset array ; THIS NEXT REQUEST IS NOT OK, ONLY FIRST DATE CHANGE. FROM '2013-12-26 10:00' to '2014-01-02 10:00' ConsoleWrite("!! Next request !!" & @CRLF) $listofmailInbox = _OL_ItemFind($oOutlook, $Folder[1], $olMail, "[ReceivedTime]>'2014-01-02 10:00' And [ReceivedTime]<'2014-01-07 16:59'", "", "", "ConversationTopic,SenderName,CreationTime,Body,EntryID", "CreationTime,True", 1) ConsoleWrite("Size of array: Ubound($listofmailInbox):" & UBound($listofmailInbox) & "||" & UBound($listofmailInbox,2)& @crlf) ;~ _ArrayDisplay($listofmailInbox) ; Uncomment to display result. _OL_Close($oOutlook) EndFunc ;==>Listes_mails Console output: Listes_mails() Size of array: Ubound($listofmailInbox):272||5 !! Next request !! Size of array: Ubound($listofmailInbox):1||5 Outlook Ex UDF : '?do=embed' frameborder='0' data-embedContent>> Here it is, if you can confirm i'm not doing anything wrong ? Thanks. Nicolas. OutlookEx Problem example.au3 Edited January 9, 2014 by satanico64 Link to comment Share on other sites More sharing options...
water Posted January 9, 2014 Share Posted January 9, 2014 Date/Time conversion isn't easy This works for me: #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 $aItems = _OL_ItemFind($oOutlook, "*\Posteingang", $olMail, "[ReceivedTime]>'02/01/2014 10:00' And [ReceivedTime]<'07/01/2014 16:59'", "", "", "Subject,ReceivedTime") If IsArray($aItems) Then _ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind Example Script - Unread mails") Else MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Could not find an unread mail. @error = " & @error & ", @extended: " & @extended) EndIf _OL_Close($oOutlook) Replace "*Posteingang" with the name of your Inbox. 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...
satanico64 Posted January 9, 2014 Author Share Posted January 9, 2014 Thanks for your answer. In fact it does works with: "[ReceivedTime]>'07/01/2014 10:00' And [ReceivedTime]<'09/01/2014 16:59'", But not with "[ReceivedTime]>'2014-01-07 10:00' And [ReceivedTime]<'2014-01-09 16:59'", In this last format, i said again that it works with others dates.. But i just change my date format, all is ok. About your answer, i didn't succeed with _OL_ItemFind($oOutlook, "<mymailbox>". But ok with _OL_ItemFind($oOutlook, $Folder[1] .... and $Folder = _OL_FolderAccess($oOutlook, "", $olFolderInbox) So thanks for your answer, and for <OutlookEX.au3> Nice to read you from France. Nicolas. Link to comment Share on other sites More sharing options...
water Posted January 9, 2014 Share Posted January 9, 2014 On some time formats Outlook seems to guess what is the day and what is the month portion of the specified date. If any value is > 12 then it has to be the day. if both values are < 12 then Outlook seems to make some incorrect assumtions. Unfortunately I haven't found a document that properly describes how it works. "<mymailbox>" works here. For you I assume it should be "*arrivee" (or something similar because my translation might be wrong). 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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now