Jump to content

OutlookEX UDF


water
 Share

Recommended Posts

Guess ... You call function _OL_ItemRecipientAdd!

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

here is my code to make an email, and to add a recipient.

why does the script keep asking me to make a new environment.

#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include 

Global $oItem
Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
Global $Result = _OL_TestEnvironmentCreate($oOutlook)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF - Manage Test Environment", "Error creating the test environment. @error = " & @error & ", @extended = " & @extended)


; *****************************************************************************
; Example 4
; Create a html email
; but don't send it
; *****************************************************************************
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*Outlook-UDF-TestTargetFolderMail", "", "Subject=note from shawn", "BodyFormat=" & $olFormatHTML, _
"HTMLBody=This is text to be read in the body of an email")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-TestTargetFolderMail'. @error = " & @error & ", @extended = " & @extended)
;$oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "The_Outlook.jpg") ; , @ScriptDir & "_OL_ItemCopy.au3, 4", @ScriptDir & "_OL_Foldertree.au3")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to a mail in folder 'Outlook-UDF-TestTargetFolderMail'. @error = " & @error & ", @extended = " & @extended)



; *****************************************************************************
; Example 1
; Add an optional recipient (the current user) to a meeting
; *****************************************************************************
Global $aOL_Item = _OL_ItemFind($oOutlook, "*Outlook-UDF-TestSourceFolderCalendar", $olAppointment, "", "", "", "EntryID")
If $aOL_Item[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemRecipientAdd Example Script", "Could not find an appointment item in folder 'Outlook-UDF-TestSourceFolderCalendar'. @error = " & @error)
Global $oItem = _OL_ItemRecipientAdd($oOutlook, $aOL_Item[1][0], Default, $olOptional, $oOutlook.GetNameSpace("MAPI").randy.field@cbn.org) ;CurrentUser.Name
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemRecipientAdd Example Script", "Error adding member to distribution list in folder 'Outlook-UDF-TestSourceFolderCalendar'. @error = " & @error & ", @extended = " & @extended)
; Display item
$oItem.Display
MsgBox(64, "OutlookEX UDF: _OL_ItemRecipientAdd Example Script", "Recipient successfully added to the appointment!")


_OL_Close($oOutlook)
Link to comment
Share on other sites

why is there a Source and Target folder. I am copying ItemRecipientAdd to my previous script and trying to get someones name in the TO: field............standby.

This is just the test environment to demo all the OutlookEX functions without crashing your Outlook.

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 should work:

#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>

Global $oItem
Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)

; Create HTML mail
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*Drafts", "", "Subject=note from shawn", "BodyFormat=" & $olFormatHTML, _
        "HTMLBody=This is text to be read in the body of an email")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail. @error = " & @error & ", @extended = " & @extended)
; Add recipient
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, "randy.field@cbn.org")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemRecipientAdd Example Script", "Error adding member to distribution list in folder 'Outlook-UDF-TestSourceFolderCalendar'. @error = " & @error & ", @extended = " & @extended)
; Display item
$oItem.Display
MsgBox(64, "OutlookEX UDF: _OL_ItemRecipientAdd Example Script", "Recipient successfully added to the appointment!")

_OL_Close($oOutlook)

P.S. I removed the dependancy of the test environment. The mail is now created in the Drafts folder.

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

one last request..........you have helped me so much. I send emails all day. This will help me automate the process. Is it possible to open the email message without having to click the drafts icon, then the newly created item in the drafts folder.

Link to comment
Share on other sites

BTW:

Please do yourself a favour and try to read the help files I provide with the UDF.

Just doing copy and paste will lead to troubles.

_OL_ItemRecipientAdd as you copied it was for an optional attendee of a meeting and wouldn't have worked for a mail.

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

one last request..........you have helped me so much. I send emails all day. This will help me automate the process. Is it possible to open the email message without having to click the drafts icon, then the newly created item in the drafts folder.

Why do you need to click the mail in the drafts folder now? Your script displays the new mail when created.

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

sure enough, there it is.......must have been behind all the open windows I got going on. I cannot thank you enough. Let me say that I do read the help files, which is good. I do not understand a lot of it, which is bad. When I get code that works, I stare at it all day long and try to learn and see how things work.

I have working at this since Aug. I will have my Mac replaced by a PC after the new year. I will now be able to use the scripts I have learned how to write in this forum and eliminate 90% of things I do every day, over and over and over again. I can make folders, open folders, cycle through folders, delete items, rename items, move items and email co-workers what has been done. I cannot thank you enough. This has made my Christmas season the best it could have ever been. Thank you Water soooo much.

Sincerely, shawn brady

Link to comment
Share on other sites

Glad all problems could be solved so you now have a happy Xmas season :D

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

Example 6 in the _OL_ItemCreate.au3 example script shows how to create a note item.

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

Hello Water.

Ive posted in this forum befor and i know you are incredibly skilled at this, so i hope that this will be a breeze for you ;)

I have created a script that updets my local Outlook Calender using AD. basicly if the info in AD doesnt coinside with the info in the contact, the contacts is updated. Evereything works great. However i would like to add pictures to all the contacts aswell as information.

_OL_ItemCreate($oOutlook,2,$folder[1],"","FirstName=" & $array1[1],"LastName=" & $array1[2],"Email1Address=" & $array1[3],"MobileTelephoneNumber=" & $array1[4],"CompanyName=" & $company)

this is the code i use to add the contacts to Outlook. Ive tried diffrent values to add a picture, but i cant get it to work. I found a VB script that is supposed to do this with the line: myContact.AddPicture strPhoto

Om guessing that the strPhoto is a varible with the path to the picture to be addes. Så i tried just ti add another parameter to the _OP_ItemCreate function. AddPicture=C:blabla.jpg but it dint work. Any suggestions?

Link to comment
Share on other sites

Hi Tjalve,

this functionality hasn't been implemented yet. What you pass to function _OL_ItemCreate are properties, you can't pass a method.

But give this a try:

$oitem = _OL_ItemCreate($oOutlook,2,$folder[1],"","FirstName=" & $array1[1],"LastName=" & $array1[2],"Email1Address=" & $array1[3],"MobileTelephoneNumber=" & $array1[4],"CompanyName=" & $company)
$oItem.AddPicture("C:\temp\picture.jpg")
$oItem.Save()

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

Details for Outlook 2010 plus an example can be found here.

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

HAHA it works perfectly. Youre the man ;)

Just one small issue. After all the contacts has been addedand i go itto the contacts folder. I dont see any thumbnails of the pictures on the "card". However if i open the contacts and click save, the thumbnail apears.

Link to comment
Share on other sites

I'm running Outllok 2010 and I have created a contact with a jpg picture and it works just fine.

Which Outlook version do you run?

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 have been trying to run examples from OutlookEX but I get errors.

I had added the following line

_OL_ErrorNotify(1)

and gives

COM Error Encountered in _OL_AccountGet.au3

OutlookEx UDF version = 0.9.0

@AutoItVersion = 3.3.8.1

@AutoItX64 = 0

@Compiled = 0

@OSArch = X86

@OSVersion = WIN_XP

Scriptline = 177

NumberHex = 800401E3

Number = -2147221021

WinDescription = Operation unavailable

Description =

Source =

HelpFile =

HelpContext = 0

LastDllError = 14007

I have outook 2003 running on windows xp

Link to comment
Share on other sites

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