water Posted April 2, 2012 Posted April 2, 2012 Sorry, mistake on my side. I updated the code in post #34 (parameter $iOL_ObjectClass is needed). 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
lolipop Posted April 2, 2012 Author Posted April 2, 2012 same error. I don't think the object class for my sample is $olMail. It's not exactly a mail attachment I think. What I do is drag and drop the au3 file from desktop to the outlook shared folder. It automatically create a item list for me in the shared folder with the au3 file. If you look at it carefully, outlook doesn't list that as a mail attachment. Does that consider a mail?
water Posted April 2, 2012 Posted April 2, 2012 Got it! Please replace $olMail with $oldocument. 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 (edited) _OL_ItemSave($oOutlook, $aItems[1][0], Default, "D:test", $olHTML, 1) Thank you very much. The script works perfectly. I have also change the $olHTML type to $olMSG instead so I can save the to MSG instead of HTML. Another question, how can I import the msg file back to a specific outlook folder I want. I have try searching in the forum but can't find any information. As far as I know, the only way is to drag and drop the msg file to the outlook folder. Edited April 3, 2012 by lolipop
water Posted April 3, 2012 Posted April 3, 2012 You call _OL_ItemCreate and pass the MSG as 4th parameter ($sOL_Template). 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 ShellExecute("Outlook", "/profile test2", "", "", @SW_HIDE) If @error Then Exit MsgBox(16, $sTitle, "Error returned by ShellExecute: " & @error & ", @extended: " & @extended) Sleep(5000) $oOutlook = _OL_Open() If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_Open: " & @error & ", @extended: " & @extended) $aFolder = _OL_FolderAccess($oOutlook, "*ImportFolder") If @error Then MsgBox(16, $sTitle, "Error returned by _OL_FolderAccess: " & @error & ", @extended: " & @extended) _OL_ItemCreate($oOutlook, $olMailItem, $aFolder, "D:testOutSwitch.au3.msg") If @error Then MsgBox(16, $sTitle, "Error returned by _OL_ItemCreate: " & @error & ", @extended: " & @extended) Endif _OL_Close($oOutlook, True) If @error Then MsgBox(16, $sTitle, "Error returned by _OL_Close: " & @error & ", @extended: " & @extended) I try using _OL_ItemCreate but it doesn't seems to create the item base on the MSG file. Is the code wrong?
water Posted April 3, 2012 Posted April 3, 2012 Try this line please: _OL_ItemCreate($oOutlook, $olMailItem, $aFolder[1], "D:testOutSwitch.au3.msg") 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 I have try with $aFolder[1] before but doesn't work.
water Posted April 3, 2012 Posted April 3, 2012 Do you get an error code? 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 no error code. the script run perfectly. Could it be MSG file cannot be used this case?
lolipop Posted April 3, 2012 Author Posted April 3, 2012 (edited) _OL_ItemCreate=($oOutlook, $olMailItem, "*Shared Folder", "D:testOutSwitch.au3.msg") I have also try this but it doesn't create the item as well Edited April 3, 2012 by lolipop
water Posted April 3, 2012 Posted April 3, 2012 No problem here (Outlook 2010) to create the item. Could you please add$iOL_Debug = 2at the top of your script after "#include <OutlookEx.au3>"? 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 Added. What should I be seeing after adding that? There is no error or dialog message.
water Posted April 3, 2012 Posted April 3, 2012 Then no error occurres 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 yup...no error at all.... The whole script below. expandcollapse popup#include <OutlookEx.au3> $iOL_Debug = 2 $sTitle = "Outlook Test Script" Global $oOL ; Close all Outlook instances While 1 $oOL = ObjGet("", "Outlook.Application") If $oOL = 0 Then ExitLoop _OL_Close($oOL, True) WEnd ; Start Outlook with the specified profile ShellExecute("Outlook", "/profile Outlook", "", "", @SW_HIDE) If @error Then Exit MsgBox(16, $sTitle, "Error returned by ShellExecute: " & @error & ", @extended: " & @extended) Sleep(5000) $oOutlook = _OL_Open() If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_Open: " & @error & ", @extended: " & @extended) $aFolder = _OL_FolderAccess($oOutlook, "*Shared Folder") If @error Then MsgBox(16, $sTitle, "Error returned by _OL_FolderAccess: " & @error & ", @extended: " & @extended) Else $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olDocument, "", "Subject", "OutSwitch.au3", "EntryID") If @error Then MsgBox(16, $sTitle, "Error returned by _OL_ItemFind: " & @error & ", @extended: " & @extended) Else If $aItems[0][0] = 0 Then MsgBox(16, $sTitle, "No mail items found!") Else _OL_ItemSave($oOutlook, $aItems[1][0], Default, "D:test", $olMSG, 1) If @error Then MsgBox(16, $sTitle, "Error returned by _OL_ItemSave: " & @error & ", @extended: " & @extended) EndIf EndIf Endif _OL_Close($oOutlook, True) If @error Then MsgBox(16, $sTitle, "Error returned by _OL_Close: " & @error & ", @extended: " & @extended) Sleep(5000) ; Start Outlook with the next specified profile ShellExecute("Outlook", "/profile test1", "", "", @SW_HIDE) If @error Then Exit MsgBox(16, $sTitle, "Error returned by ShellExecute: " & @error & ", @extended: " & @extended) Sleep(5000) $oOutlook = _OL_Open() If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_Open: " & @error & ", @extended: " & @extended) $aFolder = _OL_FolderAccess($oOutlook, "*Shared Folder") If @error Then MsgBox(16, $sTitle, "Error returned by _OL_FolderAccess: " & @error & ", @extended: " & @extended) _OL_ItemCreate($oOutlook, $olMailItem, $aFolder[1], "D:testOutSwitch.au3.msg") If @error Then MsgBox(16, $sTitle, "Error returned by _OL_ItemCreate: " & @error & ", @extended: " & @extended) Endif _OL_Close($oOutlook, True) If @error Then MsgBox(16, $sTitle, "Error returned by _OL_Close: " & @error & ", @extended: " & @extended)
water Posted April 3, 2012 Posted April 3, 2012 Can you check that the item isn't created in a different folder (like Inbox or drafts folder)? 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 checked....no item created in all the folder available within the profile. Is there anything wrongly written in my code?
water Posted April 3, 2012 Posted April 3, 2012 If you go to folder "*Shared Folder", right click and select "Properties" what do you get for the "Type" (translated form german - I hope it will be the same in english). 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
lolipop Posted April 3, 2012 Author Posted April 3, 2012 (edited) it wrote "Folder containing Mail and Post items" Edited April 3, 2012 by lolipop
water Posted April 3, 2012 Posted April 3, 2012 I'm soon running out of ideas The item we currently play with is a DocumentItem. Could you please test with a mail item? That means using the current script and search/save/create a (test) email. 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
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