Jump to content

OutlookEX UDF


water
 Share

Recommended Posts

  • Developers
1 minute ago, Kaimberex said:

try running a syntax check in SciTE before compiling and you can get the exact line number. 

correct in case au3check is able to catch this issue. Else run au3stripper with the /MergeOnly parameter and you should get a merged scriptfile that should be pretty close to the source included in the compiled script.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Which version of the UDF do you run (please check the first few lines of the UDF's source)?
  • Which version of AutoIt do you run?
  • Can you please post the script you run?

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

11 minutes ago, Kaimberex said:

When you compile a script any includes you have in your script will be added to the top when its compiled try running a syntax check in SciTE before compiling and you can get the exact line number. 

Hi Kaimberex

Thanks for your answer! No luck though - I tried to run a syntax check before compiling, but still got the same Line number :(

Link to comment
Share on other sites

  • Developers
Just now, david1337 said:

No luck though - I tried to run a syntax check before compiling, but still got the same Line number

Did au3check report any error as that tells you the proper file and linenumber? 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi water

Thank you for answering.

 

On 7/9/2016 at 5:04 PM, water said:
  • Which version of the UDF do you run (please check the first few lines of the UDF's source)?
  • Which version of AutoIt do you run?
  • Can you please post the script you run?

1. OutlookEX UDF version 0.10.0.0

2. AutoIt version 3.5.4

3. The only part of my script that causes the error is this:

#include <OutlookEX.au3>

DIM $sNewMessage = "Test"
DIM $sReplyMessage = "Test"


_OL_MailSignatureSet($sNewMessage, $sReplyMessage)

If I leave this out, no one gets the line error message.
So the error happens when the UDF opens Outlook and uses it to do a "background job" where the default signature is set.

 

On 7/9/2016 at 5:09 PM, Jos said:

Did au3check report any error as that tells you the proper file and linenumber? 

Jos

Hi Jos

Thank you for your time - The only error au3check was regarding a TrayTip: warning: $TIP_ICONASTERISK: possibly used before declaration.

But this can't be the error, because if I leave out the _OL_MailSignatureSet part, everything runs without any line errors?

EDIT: I just tried with a stripped version of the script - still not working, only this time there is no error message at all.
 

Edited by david1337
Link to comment
Share on other sites

Quite old versions of AutoIt and the UDF. 

Which version of Outlook do you run?

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

Hi water

Okay, here is a weird observation:

Someone had made a change so that the compiled exe file was executed by the user through a GPO.

I tried changing it back to run as a batch logon script which pointed to the exe file from there. Then everything worked again?

Also I noticed that it worked EVERY time if the user executed the exe file manually. So something got messed up when the exe file was executed from the GPO, but I can't figure out why :) 
 

Link to comment
Share on other sites

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

Hi Water,

Im having a problem with displaying single occurrence of a recurrent meeting series in Outlook.
This was an issue for me a few months back and you proposed this :
    "Grab the mast appointment item
     Get the recurrence information for this appointment
     Get a specific date form the recurrence pattern "
  taken from https://msdn.microsoft.com/en-us/library/office/ff868441.aspx):


I havent figured out this one as the _OL_ItemRecurrenceGet returns informatiom, but i still need to display/open single occurrence, but _OL_Item_Display() expects to recieve entryID, and that is the first appointment in the series.
My question to you: Is there a way to change the _OL_Item_Display() so it can display item with given start time or End time(something else than EntryID)
 
Thanks a lot!!!

Edited by George-Peterson
Link to comment
Share on other sites

This should do the trick (untested):

$aRecurrence = _OL_ItemRecurrenceGetEX($oOL, $vItem) ; $vItem = EntryId or Object of the appointment item
$oRecurrencePattern = $aRecurrence[14].GetRecurrencePattern
$oRecurrenceItem = $oRecurrencePattern.GetOccurrence("3/12/2003 3:00:00 PM")
$oRecurrenceItem.Display

Func _OL_ItemRecurrenceGetEX($oOL, $vItem, $sStoreID = Default)

    If Not IsObj($vItem) Then
        If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, "")
        $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
        If @error Then Return SetError(2, @error, "")
    EndIf
    ; Recurrence object of the appointment
    If $vItem.IsRecurring = False Then Return SetError(3, 0, "")
    Local $oRecurrence = $vItem.GetRecurrencePattern
    If Not IsObj($oRecurrence) Or @error Then Return SetError(4, @error, "")
    Local $aPattern[15] = [14]
    $aPattern[1] = $oRecurrence.DayOfMonth
    $aPattern[2] = $oRecurrence.DayOfWeekMask
    $aPattern[3] = $oRecurrence.Duration
    $aPattern[4] = $oRecurrence.EndTime
    $aPattern[5] = $oRecurrence.Instance
    $aPattern[6] = $oRecurrence.Interval
    $aPattern[7] = $oRecurrence.MonthOfYear
    $aPattern[8] = $oRecurrence.NoEndDate
    $aPattern[9] = $oRecurrence.Occurrences
    $aPattern[10] = $oRecurrence.PatternEndDate
    $aPattern[11] = $oRecurrence.PatternStartDate
    $aPattern[12] = $oRecurrence.RecurrenceType
    $aPattern[13] = $oRecurrence.StartTime
    $aPattern[14] = $oRecurrence
    Return $aPattern

EndFunc   ;==>_OL_ItemRecurrenceGetEX

 

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

Hi Water, 

I'm stuck on the example script for Sent Mail Event. I have a script that logs all emails moved to a folder, grabs the subject and passes it to another function which goes to a website and 'signs off' the email successfully. It works fine in my own default mailbox on any subfolder. But not for shared exchange folders.

I'm stuck on one line and have been trying different things for hours, I think I need another pair of eyes.

Snippet is here:

 

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>
_OL_ErrorNotify(2)
; *****************************************************************************
; Example Script
; Handle Outlook Folder event when a new item arrives in a folder.
; This script checks the Sent Items folder to display a message when a mail
; has been sent (= a copy of the sent mail is stored in this folder).
; This script loops until Shift-Alt-E is pressed to exit.
; *****************************************************************************

Global $oOApp = ObjCreate("Outlook.Application")
Global $aFolder = _OL_FolderAccess($oOApp, "shared@work.com\Inbox\Done")
ConsoleWrite("aFolder: " & @error & @CRLF) ;this returns 0

Global $soItems = $oOApp.GetNameSpace("MAPI").GetDefaultSharedFolder($oOApp, $aFolder[1], $olFolderInbox).Items ; 

ObjEvent($soItems, "oItems_") 

While 1
                Sleep(10)
WEnd

; Outlook 2007 - ItemAdd event - http://msdn.microsoft.com/en-us/library/bb220152%28v=office.12%29.aspx
Func oItems_ItemAdd($oOL_Item)
                Local $slength = StringLen($oOL_Item.Subject)
                Local $snipped = ($slength -36)
                Local $sString = StringTrimRight($oOL_Item.Subject, $snipped)
                MsgBox(64, "test", "MAIL Done!" & @CRLF & @CRLF & _
                                                "FW: " & $sString)
               ;global variable changed to $sString and used elsewhere successfully


EndFunc   ;==>oOFolder_ItemAdd

Func _Exit()
                Exit
EndFunc   ;==>_Exit

Different things I've tried - 

 

Global $soItems = $oOApp.GetNameSpace("MAPI").GetDefaultSharedFolder($oOApp, "shared@work.com\Inbox\Done, $olFolderInbox).Items

Global $soItems = $oOApp.GetNameSpace("MAPI").GetDefaultSharedFolder($oOApp, $aFolder[3], $olFolderInbox).Items

Global $soItems = $oOApp.GetNameSpace("MAPI").GetDefaultFolder($oOApp, $aFolder[1], $olFolderInbox).Items

I'm missing something basic that will embarrass me, I'm new to autoit and COM 

are you able to see what is wrong? 

this Global $aFolder = _OL_FolderAccess works fine and retrieves any of the shared folders. How do I use that in the ItemAdd event?

Link to comment
Share on other sites

Sorry I forgot to tell you the errors I'm getting - all to do with that line Global $soItems [depending how i change it around] WinDescription=Unknown Name. 

Then ObjEvent error is 'incorrect parameter'. But the errors vary - I get no errors on _OL_FolderAccess, or in the main oItems_ItemAdd function, just that one line. 

Link to comment
Share on other sites

Your usage of

GetDefaultSharedFolder

is wrong. You are providing too many parameters.
Shouldn't

Global $soItems = $aFolders[1].items

do the trick?

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

If you like a reply you could simply click on the "Like this" button ;)

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

@water

Hi water, i've solved the issue editing your function , added parameter for time and displayed it in a function

Global $time  = $CmdLine[2] ; reading the time of the occurrence

Global $aRecurrence = _OL_ItemRecurrenceGetEX($oOL, $entryID, $time) ; $vItem = EntryId or Object of the appointment item

 Func _OL_ItemRecurrenceGetEX($oOL, $vItem, $pTime, $sStoreID = Default)

    If Not IsObj($vItem) Then
        If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, "")
        $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
        If @error Then Return SetError(2, @error, "")
    EndIf
    ; Recurrence object of the appointment
    If $vItem.IsRecurring = False Then Return SetError(3, 0, "")
    Local $oRecurrence = $vItem.GetRecurrencePattern

    Global $oRecItem = $oRecurrence.GetOccurrence($pTime)
    $oRecItem.Display

EndFunc   ;==>_OL_ItemRecurrenceGetEX

 

Again, you've been very helpful, thanks a million and hope this helps someone else with same problem

Link to comment
Share on other sites

: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

  • 4 weeks later...

Hey water :)

I hope you can help me out with a problem I discovered in the UDF.
 

If I run this WITH or WITHOUT Outlook running, then no problem, everything works.

#include <OutlookEX.au3>

_OL_MailSignatureSet("NameOfSignature", "NameOfSignature")

 

If I add #RequireAdmin, it only works WITHOUT Outlook running.

#RequireAdmin

#include <OutlookEX.au3>

_OL_MailSignatureSet("NameOfSignature", "NameOfSignature")

If I run it from SciTE with Outlook running, I don't get any error, but it doesn't set the signature.

If I run it from compiled exe with Outlook running, I get an error "Line 9487 - Error: The requeste action with this object has failed."
(And of course it's still not setting the signature)

 

Can you reproduce this problem with whatever version of AutoIt / Outlook UDF you run?

Thanks!

 

 

Link to comment
Share on other sites

Sure. Please check the wiki (the link can be found in my signature). At the bottom you will find why Outlook doesn't work with #RequireAdmin. 

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

Ahh yes okay that makes sense - So the script needs to run with the same permissions as Outlook.
It just tried to start Outlook with admin rights, and then the script only worked with #RequireAdmin :)

A few questions - just answer if possbile.

1. Are there any other levels of permission than "Admin" and "not Admin" ?

2. Is it possible to avoid the error message, and just write to a log instead perhaps?

3. Can Autoit check which permissions Outlook is running with?

 

Again, thanks for the awesome UDF.

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