water Posted January 18, 2012 Author Share Posted January 18, 2012 Up to now I've only found a way to set the Auto-Archive properties of individual existing folders. I've searched how to set the default properties that apply to new folders but couldn't find any information. If anyone knows how to set the defaults I would be glad to hear about. 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...
aakashshah Posted January 30, 2012 Share Posted January 30, 2012 Hello! A future enhancement that would be very useful is the ability to add additional mailboxes to an Exchange profile, i.e. not a second Exchange account, but an additional mailbox: http://www.groovypost.com/howto/microsoft/add-a-second-additional-mailbox-in-outlook-2010 http://office.microsoft.com/en-us/outlook-help/add-another-person-s-mailbox-to-your-account-HP005242139.aspx Unfortunately this does not appear to be possible using an Outlook PRF file Thanks! Link to comment Share on other sites More sharing options...
water Posted January 30, 2012 Author Share Posted January 30, 2012 After searching Google for quite some time I get the impression that his can't be done using Outlook object model or CDO.So this can not become a part of the UDF.But maybe this thread helps. It looks like it can be done using PRF. 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...
ScriptingNoob Posted January 31, 2012 Share Posted January 31, 2012 Hi,I am having a bit of a challenge understanding how to Send On Behalf of another mailbox; its not a permissions issue since I can currently send on behalf via Outlook etc (and I am the admin). I am certain its me not fully understanding how to work the UDF. Dont get me wrong its awesome, but sometimes it takes a bit to click.I have been able to successfully incorporate sending an email with the "_OL_Wrapper_SendMail", but need to extend that function to use Send on Behalf, or add a "from" command as indicated in this post.I have read this thread and see what was posted in Post 11 & 12 ()In post 12 and in (http://www.autoitscript.com/wiki/OutlookEX_UDF_-_Mail_Item) they reference using "OL_ItemCreate" but I cannot wrap my head around that.Is there an easy way to incorporate $sFrom into _OL_Wrapper_SendMail or is it easier to use the new referenced function (_OL_ItemCreate).Thanks in advance. Link to comment Share on other sites More sharing options...
water Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) Hi, the example you find in the wiki should work. Could you please insert some error checking: #include <OutlookEx.au3> $iOL_Debug = 2 ; Open the connection to Outlook Global $oOL = _OL_Open() ; Create a mail item and set some properties Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "", "", _ "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>Test</b>.", "SentOnBehalfOfName=Doe Jane") MsgBox(0, "", "ItemCreate: @error = " & @error & ", @extended = " & @extended) ; Add a recipient and resolve it _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, "Doe John") MsgBox(0, "", "Add Recipient: @error = " & @error & ", @extended = " & @extended) ; Send the mail _OL_ItemSend($oOL, $oItem) If @extended = -2147352567 Then _ MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!") Edited January 31, 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...
ScriptingNoob Posted January 31, 2012 Share Posted January 31, 2012 Thanks for your response; If i try the example from the Wiki, I am curious what I should put for; *Outlook-UDF-TestTargetFolderMail I assume I would use the example as indicated but change the fields for "Doe, Jane" Thanks again. Link to comment Share on other sites More sharing options...
water Posted January 31, 2012 Author Share Posted January 31, 2012 You can replace "*Outlook-UDF-TestTargetFolderMail" with "". So the mail will be created in the default mail 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 Link to comment Share on other sites More sharing options...
ScriptingNoob Posted January 31, 2012 Share Posted January 31, 2012 Ohh and to add: If I run the above text word for word I get the following: OutlookEX UDF version = 0.6.0 Scriptline = 1474 NumberHex = 800200009 Number = -2147352567 WinDescription = Description = The operation failed. An object could not be found. Source = Microsoft Office Outlook HelpFile = Help Context = 0 LastDLLError = 0 ItemCreate: @Error = 1 Add Rcipient: @Error = 1 Link to comment Share on other sites More sharing options...
water Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) I updated the example in post #125 to return more error information. Please replace "Doe Jane" with the user you want to send the mail on behalf of and post the result. Edited January 31, 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...
ScriptingNoob Posted January 31, 2012 Share Posted January 31, 2012 This is what I get in the output window;C:Program Files (x86)AutoIt3IncludeOutlookEx.au3 (2489) : ==> Error in expression.:$oOL_Item = $oOL_Folder.Items.Add($iOL_ItemType)$oOL_Item = ^ ERROR->15:22:08 AutoIT3.exe ended.rc:1>Exit code: 1 Time: 1.627 No seperate popup with error this time.If it means anything, Win7 (x64), Office 07 SP2, Exchange '03Thanks again Link to comment Share on other sites More sharing options...
water Posted January 31, 2012 Author Share Posted January 31, 2012 I just found a bug in the _OL_ItemCreate function. Could you please run this code: #include <OutlookEx.au3> $iOL_Debug = 2 ; Open the connection to Outlook Global $oOL = _OL_Open() ; Access the default mail folder Global $aFolder = _OL_FolderAcces($oOL, "", "", $olMailItem) MsgBox(0, "", "FolderAccess: @error = " & @error & ", @extended = " & @extended) ; Create a mail item and set some properties Global $oItem = _OL_ItemCreate($oOL, $olMailItem, $aFolder[1], "", _ "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>Test</b>.", "SentOnBehalfOfName=Doe Jane") MsgBox(0, "", "ItemCreate: @error = " & @error & ", @extended = " & @extended) ; Add a recipient and resolve it _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, "Doe John") MsgBox(0, "", "Add Recipient: @error = " & @error & ", @extended = " & @extended) ; Send the mail _OL_ItemSend($oOL, $oItem) If @extended = -2147352567 Then _ MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!") I have no access to Outlook at the moment - so I hope there aren't too many bugs ;-) 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...
ScriptingNoob Posted January 31, 2012 Share Posted January 31, 2012 FolderAccess: @error = 5, @extended = 0 Link to comment Share on other sites More sharing options...
water Posted January 31, 2012 Author Share Posted January 31, 2012 There was a typo in my example. It should read "_OL_FolderAccess" not "_OL_FolderAcces". But I think you corrected it yourself. You didn't change this line?Global $aFolder = _OL_FolderAccess($oOL, "", "", $olMailItem)Because @error = 5 means that parameters 2-4 are blank. 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...
ScriptingNoob Posted January 31, 2012 Share Posted January 31, 2012 Yes, I saw the typo when it first failed, not a problem. As for the: _OL_FolderAccess($oOL, "", "", $olMailItem) I was not aware of that function; it was not part of the wiki, so I left it s default. I think I just confused myself. What parameters should be in 2-4? Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 I rewrote my example script. This should work now. #include <OutlookEx.au3> $iOL_Debug = 2 ; Open the connection to Outlook Global $oOL = _OL_Open() ; Access the default mail folder Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderDrafts) MsgBox(0, "", "FolderAccess: @error = " & @error & ", @extended = " & @extended) ; Create a mail item and set some properties Global $oItem = _OL_ItemCreate($oOL, $olMailItem, $aFolder[1], "", _ "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>Test</b>.", "SentOnBehalfOfName=Doe Jane") MsgBox(0, "", "ItemCreate: @error = " & @error & ", @extended = " & @extended) ; Add a recipient and resolve it _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, "Rupp Thomas") MsgBox(0, "", "Add Recipient: @error = " & @error & ", @extended = " & @extended) ; Send the mail _OL_ItemSend($oOL, $oItem) If @extended = -2147352567 Then _ MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!") 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...
ScriptingNoob Posted February 1, 2012 Share Posted February 1, 2012 So far, looks good. The only alerts that had been returned were 0's for Folder access / Extended ; Item create / Extended; and Add recipient / Extended. I assume zeros are OK; I guess from here I can comment out or delete the lines for MsgBox and $iOL_Debug. Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 Right, zeroes are OK. You need some error handling in your script. So I would replace the MsgBox lines with something like this: If @error Then Exit MsgBox(0, "", "FolderAccess: @error = " & @error & ", @extended = " & @extended) 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...
ScriptingNoob Posted February 1, 2012 Share Posted February 1, 2012 This works like a champ; thank you very much for your time and assistance. I know its not easy helping Newbs @ times. Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 I'm glad I could help. In my opinion the bigger challenge is the remote support: Ask the right questions so I can see the users environment and get the root cause of the problem. 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...
sellout Posted March 28, 2012 Share Posted March 28, 2012 I've been fooling around with this UDF, and somehow I've changed the label that says Mailbox - Username to Outlook-UDF-PST, and can't figure out what I did to change it or how to change it back. Any ideas? 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