water Posted April 21, 2012 Author Share Posted April 21, 2012 (edited) I believe you forgot about _OL_FolderAccess(). Isn't accepting a folder object._OL_FolderAccess (at the moment) only accesses a folder by name. If you already have the object of an folder then _OL_FolderAccess is not needed because the function only returns the object you already have. So adding support for a folder object doen't make sense to me. Edited April 21, 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...
water Posted April 21, 2012 Author Share Posted April 21, 2012 (edited) _OL_ItemCopy: My current code should already do what you want - but it doesn't. You found a bug! Now I understand why you asked for _OL_FolderAccess to support objects When the target folder is empty the source folder is assigned. But as the source folder is an object calling _OL_FolderAccess is not necessary. The next version of the UDF will have the following code: If Not IsObj($vOL_TargetFolder) Then If StringStripWS($vOL_TargetFolder, 3) = "" Then $vOL_TargetFolder = $oOL_SourceFolder Else Local $aOL_Temp = _OL_FolderAccess($oOL, $vOL_TargetFolder) If @error Then Return SetError(2, @error, 0) $vOL_TargetFolder = $aOL_Temp[1] Endif EndIf Edited April 21, 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...
LOULOU Posted April 21, 2012 Share Posted April 21, 2012 Hi water How can i add an inline attachment with your udf? Ex. <BOdy src="cid:toto.jpg"> or <Img src="cid:tre.jpg"> Thanks in advance Link to comment Share on other sites More sharing options...
water Posted April 21, 2012 Author Share Posted April 21, 2012 Hi LOULOU,I hope this answers your questions.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...
Bam Posted April 24, 2012 Share Posted April 24, 2012 (edited) Hello, I seem to be having some trouble with _OL_ItemDelete, It doesn't seem to be deleteing the email but just puting a line thro it. When I switch folders and come back the line thro it is gone. Code: Global $oOutlook = _OL_Open() $ID = "00000000FF50131DCE42AA419B8EAF968B036AA1E4002000" $StoreID = "0000000038A1BB1005E5101AA1BB08002B2A56C200007073747072782E646C6C00000000000000004E495441F9BFB80100AA0037D96E0000000043003A005C0044006F00630075006D0065006E0074007300200061006E0064002000530065007400740069006E00670073005C00420061006D005C004C006F00630061006C002000530065007400740069006E00670073005C004100700070006C00690063006100740069006F006E00200044006100740061005C004D006900630072006F0073006F00660074005C004F00750074006C006F006F006B005C004F00750074006C0044004300530058002D00300030003000300030003000300032002E007000730074000000" _ArrayDisplay(_OL_ItemGet($oOutlook, $ID, $StoreID)) ConsoleWrite("Error = " & @error & " " & @extended & @CRLF) $A = _OL_ItemDelete($oOutlook, $ID, $StoreID) ConsoleWrite("A = " & $A & @CRLF) ConsoleWrite("Error = " & @error & " " & @extended & @CRLF) Console: Error = 0 0 A = Error = 0 0 >Exit code: 0 Time: 3.796 Edited April 24, 2012 by Bam Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 (edited) Not necesserily a problem with the UDF. The error codes you get are those set by the preceding ConsoleWrite or ArrayDisplay. This should give you true error codes:Global $oOutlook = _OL_Open() $ID = "00000000FF50131DCE42AA419B8EAF968B036AA1E4002000" $StoreID = "0000000038A1BB1005E5101AA1BB08002B2A56C200007073747072782E646C6C00000000000000004E495441F9BFB80100AA0037D96E0000000043003A005C0044006F00630075006D0065006E0074007300200061006E0064002000530065007400740069006E00670073005C00420061006D005C004C006F00630061006C002000530065007400740069006E00670073005C004100700070006C00690063006100740069006F006E00200044006100740061005C004D006900630072006F0073006F00660074005C004F00750074006C006F006F006B005C004F00750074006C0044004300530058002D00300030003000300030003000300032002E007000730074000000" $aResult = _OL_ItemGet($oOutlook, $ID, $StoreID) ConsoleWrite("_OL_ItemGet: Error = " & @error & " Extended: " & @extended & @CRLF) _ArrayDisplay($aResult) ConsoleWrite("_ArrayDisplay: Error = " & @error & " Extended: " & @extended & @CRLF) $A = _OL_ItemDelete($oOutlook, $ID, $StoreID) ConsoleWrite("_OL_ItemDelete: A = " & $A & " Error = " & @error & " Extended: " & @extended & @CRLF) 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...
Bam Posted April 24, 2012 Share Posted April 24, 2012 Oh duhh, didn't think about that but I ran your code and this is what the console shows. _OL_ItemGet: Error = 0 Extended: 0 _ArrayDisplay: Error = 0 Extended: 0 _OL_ItemDelete: A = Error = 0 Extended: 0 >Exit code: 0 Time: 2.975 Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 To better understand what you try to do:How do you obtain the EntryID and StoreID?Why do you call _OL_ItemGet? It isn't needed to delete an item?What kind of item do you want to delete (amil, appointment, contact ...)Is it your own store or teh store of another user where you want to delte the item? 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...
Bam Posted April 24, 2012 Share Posted April 24, 2012 I got the EntryID from ItemFind and StoreID from FolderAccess. I call ItemGet to see if the item is still there because if it didn't then item delete worked. I want to delete and email. and on outlook there's personal folders and then there's another folder that goes ****/[Gmail]/All Mail so i think its a store of another user. But the email is getting a line through it so it supposedly marked for deletion but it seems to never go away and I've tried purging the account and restarted outlook and send and receive with no joy. Also its outlook 2007 on XP. Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 IMap Mailboxes are stored as PST files on the local computer. As far as I know when you delete an item it's not actually deleted but just marked for deletion. How to get rid of such deleted items I will have to investigate ... 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...
Bam Posted April 24, 2012 Share Posted April 24, 2012 Yeah at first I thought I was doing something wrong but when searching outlook for this problem it seems to be normal for outlook 2007 when using imap. Anyways thanks for the help Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 Did you find anything about how to get rid of deleted items in PSTs? Maybe I could create a function to be included in the next version of 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...
Bam Posted April 24, 2012 Share Posted April 24, 2012 No I haven't, the only thing I find is that if its marked for deletion it needs to be purged but that does not seem to be working in my case. Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 I know you can manualla compress PST files using Outlook. And I know that this can't be done using the COM interface. What I don't know too is if you can somehow query the delete flag using COM. Will ask Google ... 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 It looks like you can automatically compact PST files when running Outlook. You have to make sure that the items are not just deleted (= moved to the Deleted Items folder) but removed from Deleted Items folder as well before compaction will get rid of the items.Another idea:There should be no need to check an item for existance. If you find the item in a specific folder and then delete the item it is moved to the Deleted Items folder. So you shouldn't find it anymore in the folder where it was before.Can you post the complete script? 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...
Bam Posted April 24, 2012 Share Posted April 24, 2012 That was the complete script other then include lines. I was in the process of having a nice script until I ran into this problem and now it just got messy. The reason I had ItemGet was to see if the item was still there so if the script was ran more then once the email should be deleted and ItemGet should throw and error. If the item or Email was moved to deleted items folder because of ItemDelete, shouldn't ItemGet still throw an error because of the StoreID parameter? Link to comment Share on other sites More sharing options...
water Posted April 24, 2012 Author Share Posted April 24, 2012 Usually I would do the following to access a mailbox and delete an item: $oOL = _OL_Open() $aFolder = _OL_FolderAccess($oOL, "whatever foldersubfolder") $aItems = _OL_ItemFind($oOL, $aFolder[1], $olMail, "", "", "", "EntryID,StoreID") _OL_ItemDelete($oOL, $aItems[1][0], $aItems[1][1]) _OL_Close($oOL) The code only deletes the first found item, error checking is missing and the code is untested (typing on Ubuntu at the moment) but that's it. 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...
Bam Posted April 24, 2012 Share Posted April 24, 2012 Had to change it up a little but. #include <OutlookEX.au3> $oOL = _OL_Open() $aFolder = _OL_FolderAccess($oOL, "BAM[Gmail]All Mail", $olFolderInbox) $aItems = _OL_ItemFind($oOL, $aFolder[1], $olMail, "", "", "", "EntryID") _OL_ItemDelete($oOL, $aItems[1][0], $aFolder[3]) _OL_Close($oOL) This is still just putting a line through the emails and they're still there after I click purge marked items in all accounts. Link to comment Share on other sites More sharing options...
water Posted April 25, 2012 Author Share Posted April 25, 2012 So in the inbox you see the mail item striked through, but do you see the deleted item in the "Deleted Items" folder 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...
Bam Posted April 25, 2012 Share Posted April 25, 2012 (edited) No I don't but it looks like deleted items folder isn't in the account, Whats weird is Bam/[Gmail]/All Mail shows the email with a strike through it but if I go to Bam/Inbox I see the same email but no strike through it. I have a Bam/[Gmail]/Trash and don't see the striked email in there either. I'm thinking it might be a setting in outlook that's causing the problem. Edited April 25, 2012 by Bam 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