TheOne23 Posted March 14, 2019 Share Posted March 14, 2019 Hi MVPs and Experts, May I seek your assistance on how to move emails from a folder to another folder in a 1st in 1st out basis. Below is my sample script. Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) $aItems = _OL_ItemFind($oOutlook, "ronald.paggao@infosys.com\Inbox\!!! IJP\", $olMail, "[UnRead]=true", "", "", "EntryID", "", 2) ;_ArrayDisplay($aItems) if @error then MsgBox(0,"Error: ", @error) ;$iRows = (UBound($aItems, $UBOUND_ROWS))-1 $iRows = (UBound($aItems)-1) ;MsgBox(0,"",$iRows) If $iRows > 1 Then _OL_ItemMove($oOutlook, $aItems[1][0], Default, "ronald.paggao@infosys.com\Inbox\!!! IJP_test\") EndIf Link to comment Share on other sites More sharing options...
water Posted March 14, 2019 Share Posted March 14, 2019 What do you mean by "first in first out"? Moving an item does not change the date/time of arrival. 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...
TheOne23 Posted March 14, 2019 Author Share Posted March 14, 2019 Hi Water, it means that the _OL_ItemMove function should move the oldest email first before the newest or newly arrived unread email. Link to comment Share on other sites More sharing options...
water Posted March 14, 2019 Share Posted March 14, 2019 It does not matter in which order you move the mails. The order they get displayed is determined by the file you select to sort the items in the explorer. 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...
TheOne23 Posted March 14, 2019 Author Share Posted March 14, 2019 Hi Water, You mean I can sort the mails in that folder then the function will select what is in the index [1] first to move. Am I getting you right Water? Link to comment Share on other sites More sharing options...
water Posted March 14, 2019 Share Posted March 14, 2019 The OutlookEX UDF ignores how items get displayed in the GUI. You can sort items by size or date - it doesn't change the order how _OL_ItemFind fills the array. 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...
TheOne23 Posted March 14, 2019 Author Share Posted March 14, 2019 Hi Water, Make sense to me. Does _OL_ItemFind can sort the array to fill in the oldest mail first in the 1st index? Link to comment Share on other sites More sharing options...
water Posted March 14, 2019 Share Posted March 14, 2019 Please check the OutlookEx.htm help file. _OL_ItemFind provides a sort parameter. 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...
TheOne23 Posted March 14, 2019 Author Share Posted March 14, 2019 Hi Water, Thank you for your usual support and it is greatly appreciated. I will check and review it. Thank you. Link to comment Share on other sites More sharing options...
water Posted March 14, 2019 Share Posted March 14, 2019 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...
Skysnake Posted March 15, 2019 Share Posted March 15, 2019 My own issue... I have PSTs which are becoming unmanageable The idea is to make a simple GUI (Listview) which can combine non-Outlook data and include emails based on criteria. Manage them in the GUI (delete / reply etc) and update to Outlook. So the issue would be to manage the items in the GUI while using the PST as a database. Ideas on how to do this? What would the key be? Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
water Posted March 15, 2019 Share Posted March 15, 2019 I think it would be sensible to create a new topic so we do not mix this two completely different subjects. I can then post my ideas there 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...
Skysnake Posted March 16, 2019 Share Posted March 16, 2019 Who shall start? Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
water Posted March 16, 2019 Share Posted March 16, 2019 Always the one who asks 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...
TheOne23 Posted March 20, 2019 Author Share Posted March 20, 2019 Hi Water, I read the OutlookEX.au3 under _Ol_ItemFind and tried to sort it. It does Sort the items in the Array but once _ol_Itemmove is initiated, it still moves the newest item rather than what I need like moving the oldest first. Anything that you might think can do this? Thank you in advance. Link to comment Share on other sites More sharing options...
TheOne23 Posted March 20, 2019 Author Share Posted March 20, 2019 Hi Water, I already figured it out. This solved my issue. I used to count the numbers of array and since it is in a descending order then I got the EntryID of the highest Index and make it as my primary focus to pick up. Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) $aItems = _OL_ItemFind($oOutlook, "ronald.paggao@infosys.com\Inbox\!!! IJP\", $olMail, "[UnRead]=true", "", "", "EntryID", "EntryID,True", 2) if @error then MsgBox(0,"Error: ", @error) $iRows = UBound($aItems)-1 If $iRows > 1 Then _OL_ItemMove($oOutlook, $aItems[$iRows][0], Default, "ronald.paggao@infosys.com\Inbox\!!! IJP_test\") EndIf kawumm3000 1 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