Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

8 minutes ago, water said:

If you create a mail item and add "Raffaello Vaselli" as recipient is Outlook able to resolve to a valid address?
Seems that Outlook is not able to resolve the recipient because there is no address book with such an entry.

yeap, i dont use address book

i only use suggested contact

 

 

Link to comment
Share on other sites

Maybe this works:

#include <OutlookEX.au3>
Global $oOL = _OL_Open()
Global $oCurrentUser = $oOL.GetNameSpace("MAPI").CurrentUser
MsgBox(0, "", IsObj($oCurrentUser))

 

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

Do you still get "1" when removing your contact from the addressbook?

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

That's great! Could you please replace

$oOL.GetNameSpace("MAPI").CurrentUser.Name

with

$oOL.GetNameSpace("MAPI").CurrentUser

in function _OL_TestEnvironmentCreate?
Currentuser should return the Recipient object so the meeting object should be created without problems (if I'm not wrong as I can not test at the moment).

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

7 minutes ago, water said:

That's great! Could you please replace

$oOL.GetNameSpace("MAPI").CurrentUser.Name

with

$oOL.GetNameSpace("MAPI").CurrentUser

in function _OL_TestEnvironmentCreate?
Currentuser should return the Recipient object so the meeting object should be created without problems (if I'm not wrong as I can not test at the moment).

 

Worked

 

 

 

 

 

 

Link to comment
Share on other sites

Great :)
Will check if it still works in an Exchange server environment. If it does, the next version of the UDF will include this modification.
Thanks for your patience!

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

@water

thanks you,

 

but now i got some error on some exemple scripts

_OL_ItemCreate

it stop on 1 one

i also change the :

$oItem = _OL_ItemCreate($oOutlook, $olAppointmentItem, "*\Outlook-UDF-Test\TargetFolder\Calendar", "", "Subject=TestSubject", "Start=" & _NowCalc(), "End=" & _DateAdd("h", 3, _NowCalc()), _
        "Location=Building A, Room 10", "RequiredAttendees=" & $oOutlook.GetNameSpace("MAPI" ).CurrentUser)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating an appointment in folder 'Outlook-UDF-Test\TargetFolder\Calendar'. @error = " & @error & ", @extended = " & @extended)

i get the error 1 | ext 4

Link to comment
Share on other sites

Replacing "CurrentUser.Name" with "CurrentUser" does not work in the examples because the functions need the parameters as strings.
Could you try "$oOL.Session.Accounts.Item(1).SMTPaddress" instead?

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

5 minutes ago, water said:

Replacing "CurrentUser.Name" with "CurrentUser" does not work in the examples because the functions need the parameters as strings.
Could you try "$oOL.Session.Accounts.Item(1).SMTPaddress" instead?

Where, and how?

 

@water

maybe is better and easy to tell what i what

i want o open a  Template email, edit some variable(text) on body

Link to comment
Share on other sites

  1. In all example scripts - like _OL_ItemCreate.au3 - where you did notice an error
  2. Example 5 in _OL_ItemCreate.au3 explains how to create a new mail from a 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

 

Link to comment
Share on other sites

3 hours ago, water said:
  1. In all example scripts - like _OL_ItemCreate.au3 - where you did notice an error
  2. Example 5 in _OL_ItemCreate.au3 explains how to create a new mail from a template.

1- i could not find  where "Could you try "$oOL.Session.Accounts.Item(1).SMTPaddress" instead?"

2- i stated using the ex 5 but i cant get so far :( 

i get the ex tamplete on target folder,but i cant figured how to  edit/modify it

i will do some search

 

on the photo  is my template, and the body text in red it the part of the text that i want to change.

 

 

Capture.PNG

Edited by Raffav
Link to comment
Share on other sites

Is the body of the mail in format "Text" or "HTML"?

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

13 hours ago, water said:

Is the body of the mail in format "Text" or "HTML"?

HTML

i was able to add a new text on the bottom

#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)
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)
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*\Outlook-UDF-Test\TargetFolder\Mail", @ScriptDir & "\ENC_AWBB--(AWBBxxxx).oft")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)
$asBody = _OL_ItemGet($oOutlook, $oItem, Default, "HTMLBody")
$asBody[1][1] = "teste --> okok"
_OL_ItemModify($oOutlook, $oItem, Default, "HTMLBody=" & $asBody[1][1])
;~ $asBody = _OL_ItemGet($oOutlook, $oItem, Default, "BodyFormat")
;~ _ArrayDisplay($asBody)
$oitem.Display
_OL_Close($oOutlook)

 

Edited by Raffav
Link to comment
Share on other sites

Based on Example 5 it should look like this:

#include <OutlookEX.au3>

Global $oItem
Global $oOutlook = _OL_Open()
Global $Result = _OL_TestEnvironmentCreate($oOutlook)

$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*\Outlook-UDF-Test\TargetFolder\Mail", @ScriptDir & "\_OL_ItemCreate.oft")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)

; Retrieve the current mail body (HTML)
$sHTML = $oItem.HTMLBody
; Modify place holders
$sHTML = StringReplace($sHTML, "Boa tarde ", "Good day ")
$sHTML = StringReplace($sHTML, "IPREDEVSAT", "EMPRESA")
; Rewrite the mail body
$oItem.HTMLBody = $sHTML
_OL_Close($oOutlook)

 

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

51 minutes ago, water said:

Based on Example 5 it should look like this:

#include <OutlookEX.au3>

Global $oItem
Global $oOutlook = _OL_Open()
Global $Result = _OL_TestEnvironmentCreate($oOutlook)

$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*\Outlook-UDF-Test\TargetFolder\Mail", @ScriptDir & "\_OL_ItemCreate.oft")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)

; Retrieve the current mail body (HTML)
$sHTML = $oItem.HTMLBody
; Modify place holders
$sHTML = StringReplace($sHTML, "Boa tarde ", "Good day ")
$sHTML = StringReplace($sHTML, "IPREDEVSAT", "EMPRESA")
; Rewrite the mail body
$oItem.HTMLBody = $sHTML
_OL_Close($oOutlook)

 

sorry is not working

Link to comment
Share on other sites

I needed to change two things:

  • The item needs to be saved before we can access certain properties
  • We need to modify other words in the mail template
#include <OutlookEX.au3>

Global $oItem
Global $oOutlook = _OL_Open()
Global $Result = _OL_TestEnvironmentCreate($oOutlook)

$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*\Outlook-UDF-Test\TargetFolder\Mail", @ScriptDir & "\_OL_ItemCreate.oft")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)
$oItem.Save()
; Retrieve the current mail body (HTML)
$sHTML = $oItem.HTMLBody
; Modify place holders
$sHTML = StringReplace($sHTML, "Example mail", "Exemplo de correio")
$sHTML = StringReplace($sHTML, "template", "modelo")
; Rewrite the mail body
$oItem.HTMLBody = $sHTML
; Display the changed item
$oItem.Display

 

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 1 in _OL_ItemCreate.au3 shows how to use MS Word to fully edit a mail item.
Warning: This might become complex ;)

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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...