Jump to content

OutlookEX UDF - Help & Support


Recommended Posts

Loop through the array the other way round:

For $j = $aAttachments[0][0] to 1 step -1

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

That was easy :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

This UDF is great. Is there a function to snarf all the addresses in the Global Address List?

Use function _OL_AddressListMemberGet. The function only returns a few properties but as the object for each address entry is returned as well you can access all needed properties yourself.

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

please let me know how to automate outlook authentication popup.

Thanks,

Jaideep

What do you mean by "outlook authentication popup"? Can you post a screenshot? Edited by water

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'm having an issue with using the _ol_createitem UDF to create the item in another mailbox. If I leave the folder as the default it works just fine, but I want all items created to be created in this other mailbox by default. The script is:

; Open the connection to Outlook
Global $oOL = _OL_Open()
;Open the calendar folder for the secondaries sourcing calendar mailbox
Global $cal = _OL_FolderAccess($oOL, "Secondary Sourcing CalendarCalendar", $olFolderCalendar)
msgbox(0,"",@error & " " & @extended)
; Create an appointment
$oItem = _OL_ItemCreate($oOL, $olAppointmentItem, $cal, "", _
"Subject=" & GUICtrlRead($subject), "Start=" & GUICtrlRead($startDate), _
"Duration=" & GUICtrlRead($duration) & '"', "Location=" & GUICtrlRead($location), _
"RequiredAttendees=user@mail.com", "MeetingStatus=1", "Body=" & GUICtrlRead($notes))
_OL_ItemSend($oOL, $oItem)
msgbox(0,"",@error & " " & @extended)
; Close connection to Outlook
_OL_Close($oOL)

But it doesn't work. The first message box after running the folder access UDF I get @error = 0, @extended = 0. After the item is created and sent I get @error = 1 and @extended = -2147352567

Why is there no problem accessing the folder but then creating the item has problems? I set the calendar in question to allow anonymous users to create items in the calendar, since there doesn't seem to be a way to specify which user account you are using to connect. Also the documentation just says "check @extended for _ol_folderaccess", but gives no further information on how to learn what the @extended code means.

Any help?

Link to comment
Share on other sites

The extended code is 0x80020009 which means: Exception occurred. This doesn't help very much.

Can you set

$iOL_Debug = 2
at the start of the script so we can get more error information?

Can you manually create a meeting in this calendar?

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

The results of the debug window are:

COM Error Encountered in caltest.au3

OutlookEx UDF version = 0.7.1.1

@AutoItVersion = 3.3.6.1

@AutoItX64 = 0

@Compiled = 0

@OSArch = X64

@OSVersion = WIN_7

Scriptline = 3466

NumberHex = 80020009

Number = -2147352567

WinDescription =

Description = Could not open the item. Try again.

Source = Microsoft Outlook

HelpFile =

HelpContext = 0

LastDllError = 0

Yes I can manually create items in that mailbox's calendar. how does the mailbox name need to be formatted? The "firstname namefolder" is very vague. For example if my name is joe cool and my email is jcool@domain.com would it be:

joe coolcalendar

jcool@domain.localcalendar > domain account name

jcool@domain.comcalendar > email address

jcoolcalendar > domain username

any of these permutations don't work. If I leave the default as *Calendar it creates the item in my calendar just fine. If i try to manually set my own name in any of the combinations above it doesn't work - I think the problem is with the formatting of the name in referencing the mailbox and folder

Edited by benjbong
Link to comment
Share on other sites

Can you insert the MsgBox after _OL_ItemCreate so we can see if the item is created successfully?

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

According to the docu:

@error = 1: Error accessing specified folder. See @extended for errorcode returned by _OL_FolderAccess

@extended = 1: $iOL_FolderType is missing or not a number

Replace

$oItem = _OL_ItemCreate($oOL, $olAppointmentItem, $cal, "", _
with
$oItem = _OL_ItemCreate($oOL, $olAppointmentItem, $cal[1], "", _

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

Glad the problem could be solved :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

  • 2 weeks later...

Version 0.8.0.0 (Experimental) of the UDF has been released.

Please test before using in production!

For download please see my signature.

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

I'm having problems using _OL_ItemSave, specifically @error = 5, @extended = -2147352567. I've looked this up in OutlookSpy and it gives the error of 'DISP_E_EXCEPTION'. I've googled this and it gives 'Cannot save the attachments. Outlook cannot do this action on this type of attachment'.

The attachment is just a standard MS Word document (.doc) and nothing looks out of place in the IMessage > GetAttachmentTable part of OutlookSpy.

Have you an idea what is going wrong?

Link to comment
Share on other sites

What type of item do you want to save (mail, appointment ...)?

Can you post the code you have so far?

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

This is a snippet of my code.

; Get a list of attachments and save non-PDF attachments for changing to PDFs
For $i = 1 To $aResult[0][0]
ConsoleWrite("Email Subject: " & $aResult[$i][1] & @CRLF)
$aAttachments = _OL_ItemAttachmentGet($oOutlook, $aResult[$i][0])

For $j = $aAttachments[0][0] To 1 Step -1
If $aAttachments[$j][7] = "4" AND $aAttachments[$j][8] = "True" Then
_OL_ItemAttachmentDelete($oOutlook, $aResult[$i][0], Default, $j)
If @error <> 0 Then MsgBox(16, "Error", "Error deleting the attachment. @error = " & @error & ", @extended = " & @extended)
EndIf
Next
$aAttachments1 = _OL_ItemAttachmentGet($oOutlook, $aResult[$i][0])
For $t = 1 to $aAttachments1[0][0]
If StringRegExp($aAttachments1[$t][2], "pdf$|PDF$") Then
ConsoleWrite(" Attachment filename: " & $aAttachments[$t][2] & @CRLF)
ElseIf StringRegExp($aAttachments1[$t][2], "msg$|MSG$") Then
ConsoleWrite(" Email Attachment" & @CRLF)
_OL_ItemModify($oOutlook, $aResult[$i][0], Default, "Categories=Email-Attachment", "UnRead=False" )
ExitLoop
Else
_OL_ItemSave($oOutlook, $aResult[$i][0], Default, $SavePath & "", $olHTML, 2) ; !! This is the problem line !!
If @error <> 0 Then
MsgBox(16, "Error", "Error saving attachments from email '" & $aResult[$i][1] & "' to PDFConversionArea folder. @error = " & @error & ", @extended = " & @extended & @CRLF & @CRLF & "Exiting the script.")
FileDelete($SavePath & "")
Global $aItems2 = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, "[Categories]=Non-PDF", "", "", "EntryID,Subject,Body,SentOn")
If $aItems2[0][0] > 0 Then
For $y = 1 To $aItems2[0][0]
_OL_ItemModify($oOutlook, $aItems2[$y][0], Default, "Categories=AutoIT", "UnRead=False" )
Next
EndIf
Exit
Else
ConsoleWrite("Files saved succesfully" & @CRLF)
EndIf

; Set 'Non-PDF' category
_OL_ItemModify($oOutlook, $aResult[$i][0], Default, "Categories=Non-PDF", "UnRead=False" )
If @error <> 0 Then Exit MsgBox(16, "Update Category", "Error marking item with 'Non-PDF' category. @error = " & @error & ", @extended = " & @extended)
ExitLoop
EndIf
Next
Next
Edited by mdcastle
Link to comment
Share on other sites

Replace the block in function _OL_ItemSave after line "; Save attachments" with the following code (just the two ConsoleWrites added but easier to insert):

; Save attachments
    If BitAND($iFlags, 2) = 2 Then
        Local $aAttachments = _OL_ItemAttachmentGet($oOL, $vItem, $sStoreID)
        If @error = 0 Then
            For $iIndex = 1 To $aAttachments[0][0]
                If $aAttachments[$iIndex][2] = "" Then Return SetError(10, $iIndex, 0)
                If FileExists($sDrive & $sDir & $sFName & "_" & $aAttachments[$iIndex][2]) = 1 Then
                    Local $aTemp = StringSplit($aAttachments[$iIndex][2], ".")
                    For $iIndex2 = 1 To 99
                        If FileExists($sDrive & $sDir & $sFName & "_" & $aTemp[1] & "_" & $iIndex2 & "." & $aTemp[2]) = 0 Then ExitLoop
                    Next
                    If $iIndex2 > 99 Then Return SetError(8, $iIndex, 0)
ConsoleWrite("*" & $sDrive & "*" & $sDir & "*" & $sFName & "*" & "_" & "*" & $aTemp[1] & "*" & "_" & "*" & $iIndex2 & "*" & "." & "*" & $aTemp[2] & "*" & @CRLF)
                    $aAttachments[$iIndex][0] .SaveAsFile($sDrive & $sDir & $sFName & "_" & $aTemp[1] & "_" & $iIndex2 & "." & $aTemp[2])
                    If @error Then Return SetError(5, @error, 0)
                Else
ConsoleWrite("*" & $sDrive & "*" & $sDir & "*" & $sFName & "*" & "_" & "*" & $aAttachments[$iIndex][2] & "*" & @CRLF)
                    $aAttachments[$iIndex][0] .SaveAsFile($sDrive & $sDir & $sFName & "_" & $aAttachments[$iIndex][2])
                    If @error Then Return SetError(5, @error, 0)
                EndIf
            Next
        Else
            Return SetError(9, @error, 0)
        EndIf
    EndIf
    Return $vItem

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 think this is due to non-standard characters in $sFName (possibly [TAB] ??), as when I remove this from the line

$aAttachments[$iIndex][0] .SaveAsFile($sDrive & $sDir & $sFName & "_" & $aAttachments[$iIndex][2])

the attachment saves ok.

Link to comment
Share on other sites

You could replace _OL_ItemSave with _OL_ItemAttachmentSave. There you can specify the complete path.

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...