Raffav Posted December 8, 2016 Posted December 8, 2016 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
water Posted December 8, 2016 Author Posted December 8, 2016 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
Raffav Posted December 8, 2016 Posted December 8, 2016 2 minutes ago, water said: Maybe this works: #include <OutlookEX.au3> Global $oOL = _OL_Open() Global $oCurrentUser = $oOL.GetNameSpace("MAPI").CurrentUser MsgBox(0, "", IsObj($oCurrentUser)) i get a msg with "1" but had add my contact with my name on addressbook
water Posted December 8, 2016 Author Posted December 8, 2016 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
Raffav Posted December 8, 2016 Posted December 8, 2016 (edited) 6 minutes ago, water said: Do you still get "1" when removing your contact from the addressbook? yes Edited December 8, 2016 by Raffav
water Posted December 8, 2016 Author Posted December 8, 2016 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
Raffav Posted December 8, 2016 Posted December 8, 2016 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
water Posted December 8, 2016 Author Posted December 8, 2016 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
Raffav Posted December 8, 2016 Posted December 8, 2016 @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
water Posted December 8, 2016 Author Posted December 8, 2016 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
Raffav Posted December 8, 2016 Posted December 8, 2016 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
water Posted December 8, 2016 Author Posted December 8, 2016 In all example scripts - like _OL_ItemCreate.au3 - where you did notice an error 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
Raffav Posted December 8, 2016 Posted December 8, 2016 (edited) 3 hours ago, water said: In all example scripts - like _OL_ItemCreate.au3 - where you did notice an error 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. Edited December 8, 2016 by Raffav
water Posted December 8, 2016 Author Posted December 8, 2016 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
Raffav Posted December 9, 2016 Posted December 9, 2016 (edited) 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 December 9, 2016 by Raffav
water Posted December 9, 2016 Author Posted December 9, 2016 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
Raffav Posted December 9, 2016 Posted December 9, 2016 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
water Posted December 9, 2016 Author Posted December 9, 2016 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
Raffav Posted December 9, 2016 Posted December 9, 2016 @water thanks now works, but this way the assinature is removed, but for now it ok, i i can add manually
water Posted December 9, 2016 Author Posted December 9, 2016 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
Recommended Posts