Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

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

$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*AutoIt Scriptsmail", @ScriptDir & "FormatTemplate.oft")
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)
With $oItem
   .To = "test@gmail.com"
   .Send ()
EndWith

MsgBox(64, "OutlookEX UDF: _OL_ItemSend Example Script", "Mail successfully sent!")

_OL_Close($oOutlook)

 

Folder created AutoIt Scriptsmail

Template created in the same folder which contains script

Error=1, Extended=4 occurred for $oItem wih the given message.

What am I doing wrong?

Link to comment
Share on other sites

The help file for every function describes @error and @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

Have you defined multiple addresses for your mailbox?

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

Have you defined multiple addresses for your mailbox?

yes, I have.

and also please tell me, can i make changes to html body of template? For example I have a table in body message. now I have to make changes to values in table. If yes, then how can I do it?

Thanks,

Link to comment
Share on other sites

I'm not at my PC right now but you can use the HTMLBody property to read/write the mail body.

$sBody = $oItem.HTMLBody

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

Can I change Sender email address in created template?

Can't test as I have only a single address in my account. But I think it needs to be something like:

$oItem.Sender = "address" ; or
$oItem.SendUsingAccount = "address"

Sender or SendUsingAccount.

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 have a script that I have tested multiple times, but unfortunately, all attempts failed. This codes for outlook works without #RequireAdmin. When adding #RequireAdmin and run the script; nothing happen and no email were sent. When removing the #requireadmin, I get a prompt saying that send successfully. The thing is; I'm planning to use this with my other script which requires admin. How would I go about combining this script with my other script that requireadmin?

 

Code for outlook:

$oOL = _OL_Open()

_OL_Wrapper_SendMail($oOL, "test@hotmail.com","","","Here","Attachment includes user who test their footstrap. If you have any question or concern, please contact me. THIS IS A TEST!",@DesktopDir & "compare.xlsm", $olFormatRichText, $olImportanceNormal)

If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)

MsgBox(64, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Mail send successfully")

_Exit()

It seems that the script connecting to Outlook has to be started with the same permissions as Outlook.

So you can either make sure that Outlook isn't running when you start your script. This means that _OL_Open starts Outlook with admin permissions.

Or you put the code that requires admin permissions into a second independant script and start it by using Run or RunWait.

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:

It seems that the script connecting to Outlook has to be started with the same permissions as Outlook.

So you can either make sure that Outlook isn't running when you start your script. This means that _OL_Open starts Outlook with admin permissions.

Or you put the code that requires admin permissions into a second independant script and start it by using Run or RunWait.

Really? I think I even tested on separate script. The outlook without requireadmin while my IE / excel script has requireadmin. Added to runwait Outlook script on IE / Excel script and it acts as open Outlook as admin also.

 

edit: TEST

#RequireAdmin

Run(@DesktopDir & "\Email.exe")
Exit

 

Error: Line 6072

Error: Variable must be of type "Object".

If I remove requireadmin, it runs fine.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

BTW: The problem has beend described >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

Water,

It worked with this code:

#requireadmin
 
RunAs(@UserName, $Domain, $password, 0, @ComSpec & " /c start C:\users\%username%\desktop\Email.exe", @DesktopDir )
Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

Fine, so problem solved?

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

Yep, that solved, but new problem arrives.

Func EmailTime3() ;This option send the spreadsheet or report to the following user.

if FileExists(@DesktopDir & "\compare.xlsm") Then

$oOL = _OL_Open()

_OL_Wrapper_SendMail($oOL, "test@hotmail.com","","","Here","Attachment includes user who test their footstrap. If you have any question or concern, please contact me. THIS IS A TEST!",@DesktopDir & "\compare.xlsm", $olFormatRichText, $olImportanceNormal)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Mail send successfully")

_Exit()
 
    MsgBox(1, "Error", "The spreadsheet Compare.xlsm does not exist.")
EndIf

EndFunc

 

Getting error :

Error sending mail. @error = 4000, @extended:0

 

Run the script on windows 8 is fine. Just win 7 that is getting the issue.

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

I see no reason why the script should run on Windows 7 but shouldn't on Windows 8.

Same Exchange and Outlook version on 7 and 8?

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'm actually trying to create new items with a very specific ItemClass but I'm not able to get it to work.

The following code creates a new Item in the given folder:

Global $oOutlook = _OL_Open()
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*\TestFolder", "", _
'Subject=TestItem', _
'BodyFormat=' & $olFormatHTML, _
'HTMLBody=This is the body message!')

Looking at the ItemClass of those items it's always 'IPM.Note'.

 

I'd like to create the items using ItemClass: 'IPM.Note.Microsoft.Conversation' and/or 'IPM.Note.Microsoft.Conversation.Voice'

 

Is somebody able to point me into the right direction on how to set the ItemClass in this regard?

 

Thanks!!!

Link to comment
Share on other sites

The ItemClass values supported by the UDF are those listed in the OlItemType enumeration.

Why do you need to create items with those classes?

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'm actually planning to build a little tool that creates call and chat conversation 
history in an Outlook folder. Creating an item for every call and also an item for 
every chat conversation if you will. 
 
IPM.Note.Microsoft.Conversation get automatically a very nice conversation icon assigned
when it's listed in Outlook whilst IPM.Note.Microsoft.Conversation.Voice is displayed with 
a nice speech bubble.
 
 
I'd guess that there are only additional OlItemTypes required to make that work, I just don't 
know which numbers are behind those 2 types.
 
Is that anything you guys can help me with?
 
 
Thanks!
Link to comment
Share on other sites

Sorry, I have no idea how to do this.

The UDF is designed to cover basic needs and I think what you want to do is far beyond the scope of this UDF.

Hopefully someone else has some better advice for you.

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 see no reason why the script should run on Windows 7 but shouldn't on Windows 8.

Same Exchange and Outlook version on 7 and 8?

works fine on my os which is win 8. The outlook version I have is 2013. Second to that is, the outlook version on win 7 is 2010 vs the outlook version on win 8 is 2013.

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

Error sending mail. @error = 4000, @extended:0

4xxx means: Error adding adding recipients (to, cc and bcc).

The code you posted in #73 is the code that throws the error?

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