Jump to content

Outlook EX UDF _Itemreply


Go to solution Solved by water,

Recommended Posts

alright this is the last step I need and I just can't seem to figure it out.

So the first step of what I am doing is to parse and email and get the information into a mainframe system.  I will then have a person login to the mainframe and schedule a time.  Once that time is scheduled I need to reply to the existing email with that time.

Here was my plan.  Upon completion of the first step I write the mainframe ID and the entry ID to a log file.  At a given time I then query the mainframe with the mainframe id number to determine if the user has scheduled a time if the time is scheduled I load the information into an array then want to reply to the original email supplying the schedule information.

 
;I have read the log file to get the entryid and now will respond to the original email
 
$auOutlook = _OL_Open() ; Open outlook
_OL_ItemReply ($auOutlook, $log[$i][2],Default)

 

I am not sure how to format the ItemReply part.  Assuming my entry ID is correct I want to reply all with the word hello in this instance.  How would I do this?

I'm sure my explanation sucks. 

Link to comment
Share on other sites

  • Moderators

So you say you've read the Entry Item in, what is the result? You're not giving a lot to go on. Some questions to answer:

  • Have you confirmed that $log[$i][2] matches the Entry ID you need?
  • What is the result when you run your script as-is (what error checking have you done?)
  • How are you obtaining the Entry ID (assuming with _OL_ItemFind?), and does this error?

A reproducer beyond 2 lines would be great ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

_OL_ItemReply creates a copy of the specified item. With the returned object you can modify the reply and then need to send it.

$auOutlook = _OL_Open()
$oReply = _OL_ItemReply ($auOutlook, $log[$i][2])
_OL_ItemModify($auOutlook, $oReply, Default, "Body=Hello World")
_OL_ItemSend($auOutlook, $oReply)

This is untested and error checking is completely missing!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

JLogan just so you know I figured I was light on details.  I did the itemfind earlier in the script when the email comes in to a folder called process....from there I input it into the mainframe then move it to the inbox.  In order to do the move I have the entryid so I just store the entryid into a log file as I knew I was going to need it again.

Water thanks for your reply I will give that a try

 

I was hoping my storing of the entry id was successful but I am thinking that is my failure.  Does this look like an entry id?

104881,0000000004F3F169C249D711946A0008C791A51C070011DA2C94DD76234F95884AE9F250202700006CB00B2A00002FDF5F1B8A090C4DAC8B7A9FB01EC28A0080542D06610000

the first number is the mainframe schedule id the second is what I believe to be the entry id.  When I run the prior code feeding it that entry id I get an error that says

>"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:Documents and Settingsd253371Desktoparraysample.au3"
COM Error Encountered in arraysample.au3
OutlookEx UDF version = 0.9.0
@AutoItVersion = 3.3.8.1
@AutoItX64 = 0
@Compiled = 0
@OSArch = X86
@OSVersion = WIN_XP
Scriptline = 3666
NumberHex = 80020009
Number = -2147352567
WinDescription =
Description = The message you specified cannot be found.
Source = Microsoft Outlook
HelpFile =
HelpContext = 0
LastDllError = 0
========================================================
>Exit code: 0    Time: 1.755
 

Edited by Kurto2021
Link to comment
Share on other sites

Out of curiosity if I move the email from the original location to a new location does the entry id change?  Here is the code I use to write the log file and move the email

_OL_ItemMove($auOutlook, $auOutlookItems[1][0], Default, $dest[1])
$sched =  _StringStripChr($sched, " ", 3, 0)
filewrite("C:\scheduling\log.csv", $sched & "," & $auOutlookItems[1][0] & @CRLF)
Edited by Kurto2021
Link to comment
Share on other sites

As long as you move an Outlook item within the same store (e.g. your mailbox, a PST file ...) the EntryID stays the same.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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 kind of have it working.  When I reply to the email it deletes all the old info.  I can easily add in the old subject but I kind of want the email to look like the email would look if I just responded to it.  When it replies now I just create the new body then add a couple crlf's and pop in the old body.  When I reply to an email in outlook a blue line is put above the previous thread and the previous thread has a slight background color change.  If I could at least insert that separator bar that would be great.

I know I could just add a bunch of "____________" between the two but this bar that is created expands depending on the window size.  Seems much nicer.

Link to comment
Share on other sites

_OL_ItemModify just overwrites the body. You need to retrieve the body, change it and rewrite it using _OL_ItemModify.

>Example.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

hey Water I think I have found my issue now to try and figure out how to handle it. 

The email comes in I grab the entry id then modify the email and move it to the appropriate folder.  I then store the entry id to grab it later but the entry ID does change when I move the email.  I was trying to determine if it was the move or the modify that caused it but it appears to be the move.

http://social.msdn.microsoft.com/Forums/office/en-US/90f07ae2-e419-4565-bb69-6fb6cb2f11e2/outlook-email-sent-item-entryid-how-to-obtain

Do I need to use the itemsearch to find the email in question after the move and grab the entry id or is there a way to grab the entry id after the move.

One other question

; Syntax.........: _OL_ItemSearch($oOL, $vFolder, $avSearch, $sReturnProperties)

How do I learn what to key in on these? 

I know what $oOL is.

I believe $vfolder is my coded path of $inbox = "*InboxProcessScheduling"

No clue what $avSearch is supposed to be. 

I think $sReturnProperties would be "Subject" basically the field I am trying to search.

Edited by Kurto2021
Link to comment
Share on other sites

An EntryID stays the same as long as the item resides in the same store.

If you reply to an incoming mail you create a new item - with a new EntryID.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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 can assure you it is changing. I did this test. Email in folder a grab entry Id then item move to folder b then grab entry ID and it is different.

Our outlook server is cloud based so that may be a possible cause but it is definitely changing

Based on the link you sent I'm gonna assume when through the cloud sub folders in the inbox are treated like pst's. I know when we moved to the cloud we lost the ability to create local pst's.

Edited by Kurto2021
Link to comment
Share on other sites

  • Solution

Do I need to use the itemsearch to find the email in question after the move and grab the entry id or is there a way to grab the entry id after the move.

_OL_ItemMove returns the object of the moved item. So

$oMovedMail = _OL_ItemMove(....)
$sEntryID = $oMovedMail.EntryID

should give you the EntryID of the moved item.

 

One other question

; Syntax.........: _OL_ItemSearch($oOL, $vFolder, $avSearch, $sReturnProperties)

 

How do I learn what to key in on these?

Have a look at the help files that come with the UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

SUCCESS!!!!!!!!!!!!!!!

Damn changing entryid.  Water any ideas on why this changes.  Do you think it has to do with a cloud based setup and how they have it configured.  I believe MSFT is hosting our outlook servers.

Also:

Water I truly appreciate your help.  It's people like you supporting this application that make it so great.  Seems like every time I solve an issue we have here I can credit it mainly to the community.  In this case specifically you Water.  You are a rockstar!!!!!!

Edited by Kurto2021
Link to comment
Share on other sites

Damn changing entryid.  Water any ideas on why this changes.  Do you think it has to do with a cloud based setup and how they have it configured.  I believe MSFT is hosting our outlook servers.

I have absolutely no idea. I can only repeat what I've found on MSDN.

You connect to an Exchange server or what do you mean by "cloud based"?

 

Water I truly appreciate your help. It's people like you supporting this application that make it so great. Seems like every time I solve an issue we have here I can credit it mainly to the community. In this case specifically you Water. You are a rockstar!!!!!!

:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

What is going on?

XXXXX is upgrading its email system to Microsoft's Office 365 (referred to as O365) which is a cloud-based system, that will provide you with enhanced functionality, improved spam and virus protection as well as a larger mailbox!

What is the cloud?

The cloud is a friendly way of describing web-based computing services. Information storage, computation, and software are located and managed remotely on servers owned by Microsoft. Because this infrastructure is located online, you can access it virtually anywhere from a desktop, laptop, or mobile phone. 

Link to comment
Share on other sites

Microsoft loves to make changes either to Outlook/Exchange or the docu. For Outlook 2013 they write:

"Each Outlook item has a field called EntryID, which is a unique ID field generated by the messaging storage system for use with the MAPI folders that store the item. It’s important to note that whenever an item is created in a folder, it is assigned a new EntryID. This means that the EntryID field changes if an item is moved to a different folder or if an item is exported and then imported (even to the same folder)."

Very, very strange.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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 got it working but now they want it to reply to all

simple change of  this

$oReply = _OL_ItemReply ($auOutlook, $log[$i][2])

 

to this

$oReply = _OL_ItemReply ($auOutlook, $log[$i][2],Default,True)

 

but that doesn't seem to get it to send to all

Link to comment
Share on other sites

Because there is a bug in my code :(

Change

If $vItem.Class = $olMail Then
        If $bReplyAll Then
            $vItem = $vItem.Reply
            If @error Then Return SetError(3, @error, 0)
        Else
            $vItem = $vItem.Reply
            If @error Then Return SetError(3, @error, 0)
        EndIf
    EndIf

to

If $vItem.Class = $olMail Then
        If $bReplyAll Then
            $vItem = $vItem.ReplyAll ; <== Modify this line
            If @error Then Return SetError(3, @error, 0)
        Else
            $vItem = $vItem.Reply
            If @error Then Return SetError(3, @error, 0)
        EndIf
    EndIf

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Not the first and - I fear - not the last bug.

But I'm glad you like the UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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