water Posted January 31, 2014 Share Posted January 31, 2014 (edited) As the OutlookEX UDF - Help & Support thread has grown too big, I'm starting a new one. The original thread can be found here. Edited March 13, 2016 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gcue Posted January 31, 2014 Share Posted January 31, 2014 having a hard time duplicating issue now.. Link to comment Share on other sites More sharing options...
water Posted January 31, 2014 Author Share Posted January 31, 2014 If it works now - don't touch My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gcue Posted January 31, 2014 Share Posted January 31, 2014 interesting.... doesn't look like its the warning issue i dont think. if i run outlook as an admin the script is fine. if i dont run outlook as an admin, the script crashes.. *sigh* Link to comment Share on other sites More sharing options...
water Posted January 31, 2014 Author Share Posted January 31, 2014 I see. This problem is described in the wiki for the Outlook UDF. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gcue Posted January 31, 2014 Share Posted January 31, 2014 hmm this doesnt happen to me though You get @error = 1 from _OL_Open. Link to comment Share on other sites More sharing options...
gcue Posted January 31, 2014 Share Posted January 31, 2014 (edited) i also noticed, if the script has #requireadmin at the top (which it does because i need it for other stuff) then it crashes. if it doesnt have #requireadmin it works =) please dont say spawn off a new script that doesnt have #requireadmin - i am trying to cut down on seperatign from main script!! any other work around? Edited January 31, 2014 by gcue Link to comment Share on other sites More sharing options...
water Posted January 31, 2014 Author Share Posted January 31, 2014 i also noticed, if the script has #requireadmin at the top (which it does because i need it for other stuff) then it crashes. if it doesnt have #requireadmin it works =) please dont say spawn off a new script that doesnt have #requireadmin - i am trying to cut down on seperatign from main script!! any other work around? That's exactly what is described in the wiki: "It seems that the process that starts or hooks into Outlook needs to be run with the same permissions as Outlook." Haven't found a workaround so far My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 18, 2014 Moderators Share Posted February 18, 2014 (edited) Just curious if there is a way with the UDF to permenently delete items, or if you've ever investigated this? I don't do much with Outlook, but I have one script that cleans my subfolders. Currently, I loop through them with _OL_ItemFind, then _OL_ItemDelete to get rid of all but a certain number (have to retain a certain number of messages, regardless of date). This just sends to the Deleted Items folder, though. I looked briefly at the object model, and am currently doing something like this, but thought I may have missed a better way: $oOutlook.ActiveExplorer().CommandBars("Menu Bar").Controls("Tools").Controls('Empty "Deleted Items" Folder').Execute() Edited February 18, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted February 18, 2014 Author Share Posted February 18, 2014 There is a way to permanently delete items. I have already changed function _OL_ItemDelete but not published this version. I will post the function here tomorrow. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted February 19, 2014 Author Share Posted February 19, 2014 (edited) This function lets you permanently delete an item. Please test and tell me if it works for you as desired. expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name ..........: _OL_ItemDelete ; Description ...: Deletes an item (contact, appointment ...) using the specified EntryID and StoreID. ; Syntax.........: _OL_ItemDelete($oOL, $sEntryId[, $sStoreID = Default) ; Parameters ....: $oOL - Outlook object returned by a preceding call to _OL_Open() ; $vItem - EntryID or object of the item to delete ; $sStoreID - Optional: StoreID where the EntryID is stored (default = the users mailbox) ; $bPermanent - Optional: If set to True the item is permanently deleted (default = False) ; Return values .: Success - Item object or 0 when $bPermanent has been set to True ; Failure - Returns 0 and sets @error: ; |1 - No item has been specified ; |2 - Item could not be found. EntryID might be wrong ; |3 - Item could not be deleted. Please see @extended for more information ; |4 - Error returned by _OL_FolderAccess when accessing the Deleted Items folder. @extended is set to the error as returned by _OL_FolderAccess ; |5 - Error returned by _OL_ItemMove. @extended is set to the error as returned by _OL_ItemMove ; |6 - Error returned by _OL_ItemDelete. @extended is set to the error as returned by _OL_ItemDelete ; Author ........: water ; Modified ......: ; Remarks .......: To cancel a meeting you have to set property "MeetingStatus" to $olMeetingCanceled and send the meeting again ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _OL_ItemDelete($oOL, $vItem, $sStoreID = Default, $bPermanent = Default) Local $vTemp = $vitem If $bPermanent = Default Then $bPermanent = False If Not IsObj($vItem) Then If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0) $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID) If @error Then Return SetError(2, @error, 0) EndIf If $bPermanent = False Then $vItem.Delete If @error Then Return SetError(3, @error, 0) Return $vItem Else Local $oTargetFolder = _OL_FolderAccess($oOutlook, "", $olFolderDeletedItems) ; ==> Folder Deleted Items eines anderen Stores zugreifen? If @error Then Return SetError(4, @error, 0) Local $oSourceStoreID = $vItem.Parent.StoreId Local $oMovedItem = _OL_ItemMove($oOl, $vTemp, $oSourceStoreID, $oTargetFolder[1]) If @error Then Return SetError(5, @error, 0) _OL_ItemDelete($oOL, $oMovedItem.EntryID) If @error Then Return SetError(3, @error, 0) Return 0 EndIf EndFunc ;==>_OL_ItemDelete Edited February 19, 2014 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 19, 2014 Moderators Share Posted February 19, 2014 Tested on 2007-2013, works great. Thanks. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted February 19, 2014 Author Share Posted February 19, 2014 (edited) Thanks for the feedback. Will be part of the next release. At the moment the function moves the item to the "deleted items" of the users store and then permanently deletes the item. Can you think of a situation where this might be a problem when you try to delete an item form another store? Edited February 19, 2014 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 19, 2014 Moderators Share Posted February 19, 2014 Good question. I have multiple stores set up on my 2013 box. Let me play around with it today and see if I can break something. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted February 19, 2014 Author Share Posted February 19, 2014 I think it shouldn't make a difference, but who knows? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kurto2021 Posted February 28, 2014 Share Posted February 28, 2014 I have a script that runs constantly and is moving sending and deleting emails all the time. The program locked up a couple times becasue the deleted items gets full. Is there a way to delete emails and have them not go to the deleted items box. Is there a way to remove all emails from a folder instead. Link to comment Share on other sites More sharing options...
water Posted February 28, 2014 Author Share Posted February 28, 2014 The new version of _OL_ItemDelete I posted in #11 above allows to permanently delete an item. So it doesn't fill up the Deleted Items folder. To only delete mail items from a folder you need to search all mail items in the folder and then delete them one by one. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Deon Posted March 3, 2014 Share Posted March 3, 2014 What's the easiest way to show the count of my unread subfolders? I'm using the below at the moment, but want to use OutlookEX if possible to make the script better. At the moment the above script returns '0' even if there is 1 unread email in the subfolder 'Test' of folder 'Inbox'. How do I catch all unread emails in the count? $objOutlook = ObjCreate("Outlook.Application") $objNameSpace = $objOutlook.GetNamespace("MAPI") $objNamespace.Logon("Default Outlook Profile", "", FALSE, TRUE) $objFolder = $objNamespace.GetDefaultFolder(6) Msgbox(0,"Unread Email Count",$objFolder.UnreadItemCount) Link to comment Share on other sites More sharing options...
water Posted March 3, 2014 Author Share Posted March 3, 2014 To get the number of all unread mails in all subfolders you could use function _OL_FolderTree and then _OL_FolderGet for each returned folder. The array returned by _OL_FolderGet contains the number of unread items. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mumdigau Posted March 12, 2014 Share Posted March 12, 2014 I use ItemSendReceive to have Outlook synchronise with my local email server. Unfortunately, this each times opens an Outlook window showing the synchronisation progress. I added WinWaitActive/WinClose to close the window which does so, but that doesn't prevent full screen mode being interrupted (e.g. when watching a video). Any idea how I can avoid that? mumdigau Link to comment Share on other sites More sharing options...
Recommended Posts