Jump to content

OutlookEX UDF - Help & Support (II)


water
 Share

Recommended Posts

Run example script _OL_AddressListGet.au3 to see the order of the address books when resolving an address.

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 figure out how to make it work.  Our system looks at the Global Address list first then the users contacts.  I'm going to create a mailing list fo the users and put it in their personal contacts.  The program will know what list to pull based on what report they are wanting to email and it already sends the email without a problem automatically.

I think I will also write a small error routine to check for the mailing list first and if not found the user will have to specify the recipients.

I really need to read up more on the Outlookex.udf.

Thanks.

Link to comment
Share on other sites

Looks good.

I checked but it is not easy to change the resolution order of the address books. So it would be easy to overwrite "wrong" results from the GAL.

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 got the distribution list to work, but I created the list.  I'm now looking into if I can create a distribution list on the fly, put names in it from a database and then delete the distribution list once the email has been sent.

I'm looking at the ItemCreate function to see if this will work.

Link to comment
Share on other sites

Now I'm stumped.  I seem to be missing something.  I can create a distribution list and add people to it.  I can even delete the list.  But if I try to reference the list I just created the entry doesn't work. It doesn't put anything in.
 
If I reference a distribution list I created manually in Outlook, it works great.
 
Once the list is created do I need to save that item? If so, how?
 
UPDATE:
When I do a ItemRecipientCheck on the distribution list it comes back false in the array so that tells me it is not resolving. Now I need to find out how to get it to resolve.
 
Here is the code I'm using

Global $oOL = _OL_Open(True)
Global $oItemDList, $oItemAdd, $arrRecipients, $RecipientCounter, $MsgRecipients = "", $Result, $oItemDListFind
Global $ListLocation = "*\Contacts"

$oItemDList = _OL_ItemCreate($oOL, $olDistributionListItem, "", "", "Subject=StaffingReport")
if @error <> 0 then Exit msgbox("","", "Error creating distribution list " & @error & " " & @extended)

$arrRecipients = StringSplit($MessageRecipients, ";")
_ArrayDelete($arrRecipients, $arrRecipients[0])
$arrRecipients[0] = $arrRecipients[0] - 1
    
For $RecipientCounter = 1 to $arrRecipients[0]
    $oItemAdd = _OL_DistListMemberAdd($oOL, $oItemDList, Default, $arrRecipients[$RecipientCounter])
    if @error <> 0 Then Exit MsgBox("", "", "Error Adding Recipient " & @error & ", " & @extended)
Next
    
$oItemDListFind = _OL_ItemFind($oOL, $ListLocation, $olDistributionListItem, "Subject=StaffingReport")
if @error <> 0 then Exit MsgBox("","", "List not Found " & @error & " " & @extended)


_OL_Wrapper_SendMailDisplay($oOL, "StaffingReport;", "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)

Any thoughts?



Edited by Malkavian99
Link to comment
Share on other sites

This code in function _OL_TestEnvironmentCreate creates a distribution list and adds a member:

; Distribution List + Member
$vResult = _OL_ItemCreate($oOL, $olDistributionListItem, $oSourceFolderContact, "", "Subject=TestDistributionList", "Importance=" & $olImportanceHigh)
If @error Then Return SetError(506, @error, 0)
_OL_DistListMemberAdd($oOL, $vResult, Default, $sCurrentUser)
If @error Then Return SetError(507, @error, 0)

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

Great :)

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 corrected my code. I'm now receiving error 4400 and 0 on the extended when doing the Wrapper call. Here is the code.

Global $oOL = _OL_Open(True)
Global $oItemDList, $oItemAdd, $arrRecipients, $RecipientCounter, $MsgRecipients = "", $Result, $oItemDListFind
Global $ListLocation = "*\Contacts"
Global $DListName = "StaffingReport"

$oItemDList = _OL_ItemCreate($oOL, $olDistributionListItem, "", "", "Subject=" & $DListName)
If @error then Return SetError(506, @error, 0)

$arrRecipients = StringSplit($MessageRecipients, ";")
_ArrayDelete($arrRecipients, $arrRecipients[0])
$arrRecipients[0] = $arrRecipients[0] - 1

For $RecipientCounter = 1 to $arrRecipients[0]
    _OL_DistListMemberAdd($oOL, $oItemDList, Default, $arrRecipients[$RecipientCounter])
    If @error then Return SetError(507, @error, 0)
Next

$oItemDListFind = _OL_ItemFind($oOL, $ListLocation, $olDistributionListItem, "Subject=" & $DListName)
if @error <> 0 then Exit MsgBox("","", "List not Found " & @error & " " & @extended)
MsgBox("","",$DListName)
;_OL_Wrapper_SendMailDisplay($oOL, $DListName & ";", "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)
_OL_Wrapper_SendMail($oOL, $DListName & ";", "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)
MsgBox("","",@error)
MsgBox("","",@extended)
Edited by Malkavian99
Link to comment
Share on other sites

4400 means: The first recipient could not be resolved.

I will check tomorrow ...

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 can find the list using the _OL_ItemFind line and it comes back @error 0, so the Distribution List has been found.

It is just when we try to add the list to the recipients of the email it errors.  I even tried creating the email manually and adding the information just like the wrapper does. Still get 4400.

On a side note.  They are supposed to be doing maintenance on our Exchange servers this weekend so we might take this up again on Monday. I wonder if enough people made comments that made our Exchange admins take a look. 

Thanks for all your help.

Edited by Malkavian99
Link to comment
Share on other sites

Fine. Let's see what happens. If it still doesn't work as expected I will have another look :)

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

Checked this morning and not resolving. Neither is the distribution list option.  Weird that all of a sudden it would stop working.

Is there a way to add to an already created distributionlist?

I can't seem to determine how to make a object reference to the distribution list that has already been created. 

Thanks.

Edited by Malkavian99
Link to comment
Share on other sites

Use _OL_DistListMemberAdd to add a member to an existing distribution list.

_OL_DistListMemberAdd.au3 shows how to do.

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 get the distribution to work.  See my code below. Took a bit of time but it works.

It creates the distribution list 'Staffing Report', populates it with people from a database, adds the list as the recipient to the email and sends it. Then it deletes the distribution list.

Global $oOL = _OL_Open(True)
Global $oItemDList, $oItemAdd, $arrRecipients, $RecipientCounter, $MsgRecipients = "", $Result, $oItemDListFind
Global $ListLocation = "*\Contacts"
Global $DListName = "Staffing Report"

_OL_ItemCreate($oOL, $olDistributionListItem, "", "", "Subject=" & $DListName)
;if @error <> 0 then Exit msgbox("","", "Error creating distribution list " & @error & " " & @extended)
If @error then Return SetError(506, @error, 0)

$oItemDList = _OL_ItemFind($oOL, $ListLocation, $olDistributionList, "", "Subject", $DListName, "EntryID")
;if @error <> 0 then Exit MsgBox("","", "List not Found " & @error & " " & @extended)
if @error then Return SetError(507, @error, 0)

$arrRecipients = StringSplit($MessageRecipients, ";")
_ArrayDelete($arrRecipients, $arrRecipients[0])
$arrRecipients[0] = $arrRecipients[0] - 1

For $RecipientCounter = 1 to $arrRecipients[0]
    _OL_DistListMemberAdd($oOL, $oItemDList[1][0], Default, $arrRecipients[$RecipientCounter])
    ;if @error <> 0 Then Exit MsgBox("", "", "Error Adding Recipient " & @error & ", " & @extended)
    If @error then Return SetError(508, @error, 0)
Next

;_OL_Wrapper_SendMailDisplay($oOL, $DListName & ";", "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)
_OL_Wrapper_SendMail($oOL, $DListName, "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)

_OL_ItemDelete($oOL, $oItemDList[1][0], Default)
Link to comment
Share on other sites

Glad you got it working :)

As the ItemCreate function returns the object of the created itme there is no need for ItemFind.

So this should work too (untested):

Global $oOL = _OL_Open(True)
Global $oItemDList, $oItemAdd, $arrRecipients, $RecipientCounter, $MsgRecipients = "", $Result, $oItemDListFind
Global $ListLocation = "*\Contacts"
Global $DListName = "Staffing Report"

$oItemDList = _OL_ItemCreate($oOL, $olDistributionListItem, "", "", "Subject=" & $DListName)
;if @error <> 0 then Exit msgbox("","", "Error creating distribution list " & @error & " " & @extended)
If @error then Return SetError(506, @error, 0)

$arrRecipients = StringSplit($MessageRecipients, ";")
_ArrayDelete($arrRecipients, $arrRecipients[0])
$arrRecipients[0] = $arrRecipients[0] - 1

For $RecipientCounter = 1 to $arrRecipients[0]
    _OL_DistListMemberAdd($oOL, $oItemDList, Default, $arrRecipients[$RecipientCounter])
    ;if @error <> 0 Then Exit MsgBox("", "", "Error Adding Recipient " & @error & ", " & @extended)
    If @error then Return SetError(508, @error, 0)
Next

;_OL_Wrapper_SendMailDisplay($oOL, $DListName & ";", "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)
_OL_Wrapper_SendMail($oOL, $DListName, "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)

_OL_ItemDelete($oOL, $oItemDList, Default)

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

This will return the free/busy times of a meeting room for today starting from midnight. The returned string contains a "0" for every 30 minutes lot that is free.

Global $sFree = _OL_RecipientFreeBusyGet($oOutlook, "meeting room 1", "2013/11/18", 30, False)

would return something like:

000000000000002222222222222222222222000000000000000000000000002222222222222222222222000000000000000000000000000000022200002222002200000000000000000000000000000000000022222200000000000000000000000000000000000022222222222222220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222222002200000000000000000000000000000000000000000000000022220000000000000000000000000000000000222220000000222000000000000000000000000000000000000000000000000000000000000000000000000000000000222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000220000000000000000000000000000000000000000000000002220000222222000222200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002220002222222200000000000000000000000000000000000000000000000000000000000000000000000000000000022200000222000000000000000000000000000000000000000000000000000000000000000000000000000000000000222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Edited by water

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

 

Glad you got it working :)

As the ItemCreate function returns the object of the created itme there is no need for ItemFind.

So this should work too (untested):

Global $oOL = _OL_Open(True)
Global $oItemDList, $oItemAdd, $arrRecipients, $RecipientCounter, $MsgRecipients = "", $Result, $oItemDListFind
Global $ListLocation = "*\Contacts"
Global $DListName = "Staffing Report"

$oItemDList = _OL_ItemCreate($oOL, $olDistributionListItem, "", "", "Subject=" & $DListName)
;if @error <> 0 then Exit msgbox("","", "Error creating distribution list " & @error & " " & @extended)
If @error then Return SetError(506, @error, 0)

$arrRecipients = StringSplit($MessageRecipients, ";")
_ArrayDelete($arrRecipients, $arrRecipients[0])
$arrRecipients[0] = $arrRecipients[0] - 1

For $RecipientCounter = 1 to $arrRecipients[0]
    _OL_DistListMemberAdd($oOL, $oItemDList, Default, $arrRecipients[$RecipientCounter])
    ;if @error <> 0 Then Exit MsgBox("", "", "Error Adding Recipient " & @error & ", " & @extended)
    If @error then Return SetError(508, @error, 0)
Next

;_OL_Wrapper_SendMailDisplay($oOL, $DListName & ";", "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)
_OL_Wrapper_SendMail($oOL, $DListName, "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)

_OL_ItemDelete($oOL, $oItemDList, Default)

I tried that first and for some reason that would not work. Not sure why, but adding the find seemed to work.  I compiled the program yesterday and it worked great this morning when our Administrative Assistants did their morning staffing reports. 

I will take a look at your code and see if there is something I was doing that was making it not work.  Thanks.

Link to comment
Share on other sites

I just tried to remove the find funtion because of the performance penalty.

But if it works for you and you are happy with the performance then just use what works 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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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