Jump to content
water

OutlookEX UDF - Help & Support (IV)

Recommended Posts

It looks like there's an error in the documentation... there are 6 references to _OL_AccessFolder, but I think it means _OL_FolderAccess :)
(Using version 1.3.6.0)

It also would be nice to have the default name for an attachment be the name of the file. (I slightly freaked out when I saw an empty name) I usually do this:

; Get everything to the right of the last backslash
Local $sFileName = StringTrimLeft($sFilePath, StringInstr($sFilePath, "\", 0, -1))
; And support UNC filepaths too!
$sFileName = StringTrimLeft($sFilePath, StringInstr($sFilePath, "/", 0, -1))
Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Share this post


Link to post
Share on other sites
14 hours ago, seadoggie01 said:

error in the documentation...

Fixed.

 

14 hours ago, seadoggie01 said:

It also would be nice to have the default name for an attachment be the name of the file

You are talking about _OL_ItemSave or _OL_AttachmentSave?

As _OL_ItemSave and _OL_AttachmentSave provide the functionality to save attachments I'm thinking about moving all relevant lines of code to _OL_AttachmentSave and just call this function from _OL_ItemSave. So we have only a single function to modify if needed.

What do you think?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Oh, I forgot to post what function I'm using!

_OL_AttachmentAdd($oOL, $oEmail, $oDraftsFolder, "C:\Path\MyFile.xlsx")

This will add an attachment to my draft, but the displayed name is left blank, so the attachment ends up looking like this:

image.png.1700f279f4deaff763e6b276731ea2a3.png

It looks like there is no default value for the display name ($aTemp[4] ~ line 2299) if you pass a file path


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Share this post


Link to post
Share on other sites

Could you please test this _OL_ItemAttachmentAddEX.au3?

Func _OL_ItemAttachmentAddEX($oOL, $vItem, $sStoreID, $vP1, $vP2 = "", $vP3 = "", $vP4 = "", $vP5 = "", $vP6 = "", $vP7 = "", $vP8 = "", $vP9 = "", $vP10 = "", $sDelimiter = ",")

    If $sDelimiter = Default Then $sDelimiter = ","
    Local $aAttachments[10]
    If Not IsObj($vItem) Then
        If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0)
        $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
        If @error Then Return SetError(2, @error, 0)
    EndIf
    ; Move attachments into an array
    If Not IsArray($vP1) Then
        $aAttachments[0] = $vP1
        $aAttachments[1] = $vP2
        $aAttachments[2] = $vP3
        $aAttachments[3] = $vP4
        $aAttachments[4] = $vP5
        $aAttachments[5] = $vP6
        $aAttachments[6] = $vP7
        $aAttachments[7] = $vP8
        $aAttachments[8] = $vP9
        $aAttachments[9] = $vP10
    Else
        $aAttachments = $vP1
    EndIf
    ; Add attachments to the item
    For $iIndex = 0 To UBound($aAttachments) - 1
        If $aAttachments[$iIndex] = "" Or $aAttachments[$iIndex] = Default Then ContinueLoop
        Local $aTemp = StringSplit($aAttachments[$iIndex], $sDelimiter)
        ReDim $aTemp[5] ; Make sure the array has 4 elements (element 2-4 might be empty)
        If StringMid($aTemp[1], 2, 1) = ":" Or StringLeft($aTemp[1], 2) = "\\" Then ; Attachment specified as file (drive letter or UNC path)
            If Not FileExists($aTemp[1]) Then Return SetError(4, $iIndex, 0)
            ; Set filename/extension as Displayname when no DisplayName has been specified
            If $aTemp[4] = "" Then 
                ; Get everything to the right of the last backslash
                Local $sFileName = StringTrimLeft($aTemp[1], StringInstr($aTemp[1], "\", 0, -1))
                ; And support UNC filepaths too!
                $aTemp[4] = StringTrimLeft($sFileName, StringInstr($sFileName, "/", 0, -1))
            EndIf
        ElseIf Not IsObj($aTemp[1]) Then ; Attachment specified as EntryID
            If StringStripWS($aAttachments[$iIndex], 3) = "" Then ContinueLoop
            $aTemp[1] = $oOL.Session.GetItemFromID($aTemp[1], $sStoreID)
            If @error Then Return SetError(4, $iIndex, 0)
        EndIf
        If $aTemp[2] = "" Then $aTemp[2] = $olByValue ; The attachment is a copy of the original file
        If $aTemp[3] = "" Then $aTemp[3] = 1 ; The attachment should be placed at the beginning of the message body
        $vItem.Attachments.Add($aTemp[1], $aTemp[2], $aTemp[3], $aTemp[4])
        If @error Then Return SetError(3, $iIndex, 0)
    Next
    $vItem.Save()
    Return $vItem

EndFunc   ;==>_OL_ItemAttachmentAdd

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Will be part of the next release ;)

Added you to the contributors of this UDF :)

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I'm having an issue getting members of distribution lists for some lists.  _OL_ItemRecipientCheck is giving me a False for "if the recipient could be resolved successfully," and not returning an AddressEntry object.  There is one thing that I did notice is the lists that are having issues have the same start of its list name as some other lists.  Do you know of a different way to get the AddressEntry object for the members to be resolved?  The problem groups are showing their members fine in the Address Book.  Example list names below.  Script is below.  

Libs_Archives_and_Special_Collections          <== Giving the "False" and will not return an AddressEntry object.
Libs_Archives_and_Special_Collections_Faculty
Libs_Archives_and_Special_Collections_Staff
#include <AD.au3>
#include <Array.au3>
#include <Debug.au3>
#include <OutlookEX.au3>

ProgressOn("Get LIBS Distribution Groups", "")

Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)

Global $sSearch = "Distribution Lists"

ProgressSet(10, "", "Getting All " & $sSearch)
;~ Global $aGroups = _OL_AddressListGet($oOutlook, True)
Global $aGroups = _OL_AddressListGet($oOutlook, False)
If @error <> 0 Then _
    Exit MsgBox(16, "OutlookEX UDF: _OL_AddressListGet Example Script", "Error " & @error & " when listing all address lists!")
;~ _DebugArrayDisplay($aGroups) ;For testing.


Global $iSearch = _ArraySearch($aGroups, $sSearch, 1, 0, 0, 1, 1, 1)

$aGroups = _OL_AddressListMemberGet($oOutlook, $aGroups[$iSearch][2])
If @error <> 0 Then _
    Exit MsgBox(16, "OutlookEX UDF: _OL_AddressListMemberGet Example Script", "Error " & @error & " gettings members of first address lists!")
;~ _DebugArrayDisplay($aGroups) ;For testing.
 
 ProgressSet(10, "", "Getting LIBS " & $sSearch)
 
;Delete non "libs" address lists from array.
Global $sDelete = ""
For $i = 1 To $aGroups[0][0] Step 1
    If Not StringRegExp($aGroups[$i][1], "(?i)^libs") Then $sDelete &= $i & ";"
    ProgressSet(10 + ($i / $aGroups[0][0]) * 15, $aGroups[$i][1], "Getting LIBS " & $sSearch)
Next
$sDelete = StringTrimRight($sDelete, 1)
_ArrayDelete($aGroups, $sDelete)
$aGroups[0][0] = UBound($aGroups, $UBOUND_ROWS) - 1
 _DebugArrayDisplay($aGroups)

_AD_Open()

;Get the members of the groups returned.
Global $aFileCSV[1000][$aGroups[0][0]]
Global $aGroupMembers
Global $sDisabledInactiveUsers = ""
Global $aRecipient = 0

For $iGroupIndex = 1 To $aGroups[0][0] Step 1
    ConsoleWrite($aGroups[$iGroupIndex][1]) ;For testing.
    
    $aRecipient = _OL_ItemRecipientCheck($oOutlook, $aGroups[$iGroupIndex][1])  ; <== Issue Here _OL_ItemRecipientCheck returning False, and not returning  AddressEntry object.
    If $aRecipient[$aRecipient[0][0]][1] = False Then 
        ConsoleWrite("*" & @CRLF) ;For testing.
        Dim $aGroupMembers[2][3]= [[1,0,""],["","Error Resolving Members", ""]]
    Else
        ConsoleWrite(@CRLF) ;For testing.
        $aGroupMembers = _OL_DistListMemberGet($oOutlook, $aRecipient[1][3])
    EndIf 
    
;~  _DebugArrayDisplay($aGroupMembers, $aGroups[$iGroupIndex][1]) ;For testing.
    
    ;sAMAccountName,Displayname,FQDN
    For $j = 1 To $aGroupMembers[0][0] Step 1
        $aGroupMembers[$j][2] = _AD_DisplayNameToFQDN($aGroupMembers[$j][1])
        If @error Then $aGroupMembers[$j][2] = ""
        $aGroupMembers[$j][0] = _AD_FQDNToSamAccountName($aGroupMembers[$j][2])
        If @error Then $aGroupMembers[$j][0] = ""
    Next
    
;~  _DebugArrayDisplay($aGroupMembers, $aGroups[$iGroupIndex][1]) ;For testing.
        
    Global $aGroupMembersDisplayName[$aGroupMembers[0][0] + 1] = [$aGroupMembers[0][0]]
    
    Global $sdisplayName, $ssAMAccountName
    For $iMemberIndex = 1 To $aGroupMembers[0][0] Step 1
        $sdisplayName = $aGroupMembers[$iMemberIndex][1]
        $ssAMAccountName = $aGroupMembers[$iMemberIndex][0]
        
        If $sdisplayName <> "" And $ssAMAccountName <> "" Then
            $aGroupMembersDisplayName[$iMemberIndex] = StringReplace($sdisplayName, ",", ", ") & " (" & $ssAMAccountName & ')'
        ElseIf $sdisplayName <> "" Then
            $aGroupMembersDisplayName[$iMemberIndex] = StringReplace($sdisplayName, ",", ", ")
        Else
            $aGroupMembersDisplayName[$iMemberIndex] = $ssAMAccountName
        EndIf
        
        If StringInStr($aGroupMembers[$iMemberIndex][2], ",OU=retirees,") Then 
            $aGroupMembersDisplayName[$iMemberIndex] &= " (RETIREE)"
        ElseIf StringInStr($aGroupMembers[$iMemberIndex][2], ",OU=inactive,") Then 
            $aGroupMembersDisplayName[$iMemberIndex] &= " (INACTIVE)"
        ElseIf _AD_IsObjectDisabled($aGroupMembers[$iMemberIndex][1]) Then 
            $aGroupMembersDisplayName[$iMemberIndex] &= " (DISABLED)"
        EndIf
        
        If StringInStr($aGroupMembersDisplayName[$iMemberIndex], "(DISABLED)") Or StringInStr($aGroupMembersDisplayName[$iMemberIndex], "(INACTIVE)") Or _
            StringInStr($aGroupMembersDisplayName[$iMemberIndex], "(RETIREE)") Then _
            $sDisabledInactiveUsers &= $aGroupMembersDisplayName[$iMemberIndex] & " (" & $aGroups[$iGroupIndex][1] & ")" & @CRLF 
        
        ProgressSet(25 + Int(($iGroupIndex / $aGroups[0][0]) * 75), $sdisplayName, $aGroups[$iGroupIndex][1])
    Next
    
    _ArraySort($aGroupMembersDisplayName, 0, 1)
    
    For $iMemberIndex = 0 To $aGroupMembersDisplayName[0] Step 1
        If $iMemberIndex = 0 Then
            $aFileCSV[$iMemberIndex][$iGroupIndex - 1] = $aGroups[$iGroupIndex][1]
        Else
            $aFileCSV[$iMemberIndex][$iGroupIndex - 1] = $aGroupMembersDisplayName[$iMemberIndex]
            ConsoleWrite($aGroupMembersDisplayName[$iMemberIndex] & @CRLF) ;For testing.
        EndIf
    Next
    ConsoleWrite(@CRLF) ;For testing.
Next
_AD_Close()
_OL_Close($oOutlook)

ProgressSet(100, " ", "Writing CSV File.")

;Scan $aFileCSV array to find first row of empty values.
;~ _DebugArrayDisplay($aFileCSV, "$aFileCSV")
Global $iEmptyColCount = 0
Global $iMaxRowIndex = 0
For $iRow = 0 To UBound($aFileCSV, 1) - 1 Step 1
    For $iCol = 0 To UBound($aFileCSV, 2) - 1 Step 1
        If $aFileCSV[$iRow][$iCol] = "" Then $iEmptyColCount += 1
        If $iCol = UBound($aFileCSV, 2) - 1 And $iEmptyColCount = UBound($aFileCSV, 2) Then
            $iMaxRowIndex = $iRow
            ExitLoop 2 ;Exit both loops.
        ElseIf $iCol = UBound($aFileCSV, 2) - 1 And $iEmptyColCount <> UBound($aFileCSV, 2) Then
            $iEmptyColCount = 0
        EndIf
    Next
Next

ProgressOff()

;Resize the $aFileCSV array to remove empty rows, and reduce file size.  
;~ _DebugArrayDisplay($aFileCSV, "$aFileCSV")
ReDim $aFileCSV[$iMaxRowIndex][$aGroups[0][0]]
_DebugArrayDisplay($aFileCSV, "$aFileCSV")

; #FUNCTION# ====================================================================================================================
; Name...........: _AD_DisplayNameToFQDN
; Description ...: Returns a Fully Qualified Domain Name (FQDN) from a DisplayName.
; Syntax.........: _AD_DisplayNameToFQDN($sDisplayName)
; Parameters ....: $sDisplayName - Display name of AD object.
; Return values .: Success - Fully Qualified Domain Name (FQDN)
;                  Failure - "", sets @error to:
;                  |1 - No record returned from Active Directory. $sDisplayName not found
;                  |2 - More than one record found for $sDisplayName. Use _AD_GetObjectsInOU to get multiple FQDNs for DisplayName. 
; Author ........: Jonathan Clelland from _AD_SamAccountNameToFQDN
; Modified.......: AdamUL, water from _AD_SamAccountNameToFQDN
; Remarks .......: The function escapes the following special characters (# and /). Commas in CN= or OU= have to be escaped by you.
;                  If $sDisplayName is already a FQDN then the function returns $sDisplayName unchanged and without raising an error.
; Related .......: _AD_FQDNToDisplayName
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _AD_DisplayNameToFQDN($sDisplayName)

    If StringMid($sDisplayName, 3, 1) = "=" Then Return $sDisplayName ; already a FQDN. Return unchanged
    $__oAD_Command.CommandText = "<LDAP://" & $sAD_HostServer & "/" & $sAD_DNSDomain & ">;(displayName=" & $sDisplayName & ");distinguishedName;subtree"
    Local $oRecordSet = $__oAD_Command.Execute
    If @error Or Not IsObj($oRecordSet) Or $oRecordSet.RecordCount = 0 Then Return SetError(1, @error, "")
    If $oRecordSet.RecordCount > 1 Then Return SetError(2, 0, "")
    Local $sFQDN = $oRecordSet.fields(0).value
    Return _AD_FixSpecialChars($sFQDN, 0, "/#")

EndFunc   ;==>_AD_DisplayNameToFQDN

 

Thanks for the help.

Adam

Share this post


Link to post
Share on other sites

Will test as soon as I find some spare time - hopefully this week 🙄


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Fixed :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

@AdamUL

The problem you see  is caused by the way $oRecipient.Resolve works. It compares the recipients from left to right.
If there is a group "x" and a group "x-leaders" and you try to resolve "x" then Outlook finds both.
I couldn't find a way to tell Outlook to do a strict comparison.

That's why _OL_ItemRecipientSelect was created. You can select the recipient you want to use.

I know it's just a work around but it's the best I could find.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Just as I pressed the "Submit Reply" button I found the solution.

Prepend the recipient to check with an "=" for a strict resolution. Means:

$aRecipient = _OL_ItemRecipientCheck($oOutlook, "=" & $aGroups[$iGroupIndex][1])  ; <== Issue Here _OL_ItemRecipientCheck returning False, and not returning AddressEntry object.

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Need to update the description of the UDF and the wiki ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Now this issue is resolved.  I'm working on getting the owners of the distribution lists.  

https://docs.microsoft.com/en-us/office/vba/api/outlook.exchangedistributionlist.getowners

Update: For those that need to get the owners of a distribution list.  Snippet below.  

$aRecipient = _OL_ItemRecipientCheck($oOutlook, $aGroups[$iGroupIndex][1])

;Check values
ConsoleWrite("GetOwners.Count: " & $aRecipient[1][3].GetOwners.Count & @CRLF)
ConsoleWrite("GetOwners.Item: " & $aRecipient[1][3].GetOwners.Item(1).Name & @CRLF)

;Get owners.
Global $sOwners = ""
For $i = 1 To $aRecipient[1][3].GetOwners.Count
    $sOwners = $aRecipient[1][3].GetOwners.Item($i).Name & "|"
Next
$sOwners = StringTrimRight($sOwners, 1)

Global $aOwners = StringSplit($sOwners, "|")
_DebugArrayDisplay($aOwners, "$aOwners")

Adam

 

Edited by AdamUL
Added GetOwners snippet.

Share this post


Link to post
Share on other sites

I have modified _OL_ItemRecipientCheck so "strict" is now the default when resolving a recipient. You can set a flag to disable this feature.
The function takes into account if you have already prefixed the recipient with "=".


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi water,

Thanks for the updated UDF.  When a "=" is prefixed on the recipient, it returns False all the the time, when $bStrict is True.  When I take it off, it works as expected.  Is this to be expected? 

 

Adam

Share this post


Link to post
Share on other sites

No, this isn't to be expected.

What do you get when you run the _OL_ItemRecipientCheck.au3 example script?
Recipient 1 and 2 should return True, recipient 3 returns False.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

That is what I get when I run the example script.  

On my report script above, if I leave the following below, it will not resolve any distribution list.  

$aRecipient = _OL_ItemRecipientCheck($oOutlook, "=" & $aGroups[$iGroupIndex][1])

When I change it back as in the above report script, everything resolves correctly.  

$aRecipient = _OL_ItemRecipientCheck($oOutlook, $aGroups[$iGroupIndex][1])

 

Adam

Share this post


Link to post
Share on other sites

I see. Somehow the check for an already existing "=" in the parameter got lost :(
Please modify

If $bStrict Then
            $oRecipient = $oOL.Session.CreateRecipient("=" & $asRecipients[$iIndex])
        Else
            $oRecipient = $oOL.Session.CreateRecipient($asRecipients[$iIndex])
        EndIf

to

If $bStrict And StringLeft($asRecipients[$iIndex], 1) <> "=" Then
            $oRecipient = $oOL.Session.CreateRecipient("=" & $asRecipients[$iIndex])
        Else
            $oRecipient = $oOL.Session.CreateRecipient($asRecipients[$iIndex])
        EndIf

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

  • Similar Content

    • By Skysnake
      This assumes implementation of the OutlookEX UDF.
      I have PSTs which are becoming unmanageable 
      The idea is to make a simple GUI (Listview) which can combine non-Outlook data and include emails based on criteria.  Manage them in the GUI (delete / reply etc) and update to Outlook.
      So the issue would be to manage the items in the GUI while using the PST as a database.
      Ideas on how to do this? What would the key be?
    • By Reizvoller
      Howdy!
      I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! ) 
      https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General
       
      But I've had trouble locating information on specifying what user to use. My outlook is linked to two email accounts and I can only manipulate the main account's stuff. A simple script I've been playing with is this 
      ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "*") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @error) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") It works like a charm but it only returns my main account's folders. 
      I really hope I didn't overlook a wiki page or help file... 
      Any assistance would be greatly appreciated!
      -Reiz
    • By galan2015
      Is there any solution on receiving e-mails? I would like to create a script so that I will not have to log in through the browser.
×
×
  • Create New...