Jump to content

OutlookEX UDF


water
 Share

Recommended Posts

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

  • 2 weeks later...

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

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

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

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 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

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

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

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 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

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 '03

Thanks again

Link to comment
Share on other sites

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

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

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

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

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

  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...