Jump to content

OutlookEX UDF - Help & Support


Recommended Posts

$aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CompanyName]='Name of the Company' And [FullName]='Fullname you search for'", "", "", "EntryID" )

Does this support a wildcard character? I'm trying to search for contacts that CustomerID = 1 ( which most are in my case, it's used to tell my software that it should be visible, CustomerID = 2 means disabled) and CompanyName begins with whatever string is typed into search input.

$aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CompanyName]='"&$search&"' And [CustomerID]='1', "", "", "EntryID" )

Thing is I need a partial search for CompanyName with CustomerID to be 1. Is that possible without doing loops to string search? This is how I am doing this now but it it slow. I loop every contact to compare the begining string by length. Any advice?

$aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CustomerID]='1'","", "", "EntryID" )

$prog = 100 / $aEntryID[0][0]

If IsArray( $aEntryID ) Then

$slen = StringLen( $search )

$i = 0

Do

$uprog = $uprog + $prog

GUICtrlSetData( $PBAR, $uprog )

$i = $i + 1

$aResult = _OL_ItemGet( $oOutlook, $aEntryID[$i][0], "", "FullName,JobTitle,CompanyName,BusinessTelephoneNumber,BusinessAddressStreet,BusinessAddressCity,BusinessAddressState,BusinessAddressPostalCode,BusinessAddressCountry,BusinessFaxNumber,MobileTelephoneNumber,Email1Address,WebPage,Body,CustomerID" )

If $aResult[10][1] <> 2 Then

$aTel = StringLeft( $aResult[8][1], 2 )

If $aTel = "+1" Then

$Tel = StringTrimLeft( $aResult[8][1], 3 )

Else

$Tel = $aResult[8][1]

EndIf

$str_OL = StringLeft( $aResult[9][1], $slen )

$compar = StringCompare( $str_OL, $search )

If $compar = 0 Then

GUICtrlCreateListViewItem( $aResult[9][1] & "|" & $aResult[12][1] & "|" & $Tel & "|" & $aResult[2][1] & "|" & $aResult[5][1] & "|" & $aResult[4][1] & "| ", $hListView )

EndIf

EndIf

Until $i = $aEntryID[0][0]

Link to comment
Share on other sites

Haven't tried it but I think it should work:

$aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CustomerID]='1', "CompanyName", $search, "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

A quick solution would be to change line

If $sOL_SearchName <> "" And StringInStr($oOL_Item.ItemProperties.Item($sOL_SearchName).value, $sOL_SearchValue) = 0 Then ContinueLoop
in function _OL_ItemFind to
If $sOL_SearchName <> "" And StringLeft($oOL_Item.ItemProperties.Item($sOL_SearchName).value, Stringlen($sOL_SearchValue)) <> $sOL_SearchValue Then ContinueLoop

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

Version 0.5.0 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

$oOutlook = _OL_Open()
$aFolder = _OL_FolderAccess( $oOutlook, "", $olFolderContacts )
$aEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CompanyName]='"&$company&"' AND [FullName]='"&$con&"'", "", "", "EntryID" )
If $aEntryID[0][0] = 0 Then
  _OL_ItemCreate( $oOutlook, $olContactItem, $aFolder[1], "", "FullName="&$con, "CompanyName="&$company, "BusinessTelephoneNumber="&$BusinessPhone, "BusinessAddressStreet="&$address, "BusinessAddressCity="&$city, "BusinessAddressState="&$state, "BusinessAddressPostalCode="&$zip)
  $bEntryID = _OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CompanyName]='"&$company&"' AND [FullName]='"&$con&"'", "", "", "EntryID" )
  _OL_ItemModify( $oOutlook, $bEntryID[1][0], "", "BusinessAddressCountry="&$country, "BusinessFaxNumber="&$fax, "MobileTelephoneNumber="&$cell, "Email1Address="&$email, "Body="&$comment, "CustomerID=1" )
   If not @error Then MsgBox( 0, "SUCCESS", "CONTACT CREATED" )
Else
  $aResult = _OL_ItemGet( $oOutlook, $aEntryID[1][0], "", "CompanyName,FullName,Body" )
  $body = $aResult[1][1] & "|" & $comment
  _OL_ItemModify( $oOutlook, $aEntryID[1][0], "", "FullName="&$con, "CompanyName="&$company, "BusinessTelephoneNumber="&$BusinessPhone, "BusinessAddressStreet="&$address, "BusinessAddressCity="&$city, "BusinessAddressState="&$state, "BusinessAddressPostalCode="&$zip)
  _OL_ItemModify( $oOutlook, $aEntryID[1][0], "", "BusinessAddressCountry="&$country, "BusinessFaxNumber="&$fax, "MobileTelephoneNumber="&$cell, "Email1Address="&$email, "Body="&$body, "CustomerID=1" )
   If not @error Then MsgBox( 0, "SUCCESS", "CONTACT UPDATED" )
EndIf
I have a bug in _OL_ItemFind. A pc on my network runs the same XP and MSOffice 2007, this particular pc errors out on that function when _OL_ItemCreate is run and because it has more properties I call:

_OL_ItemFind( $oOutlook, $aFolder[1], $olContact, "[CompanyName]='"&$company&"' and [FullName]='"&$contact&"'", "", "", "EntryID,CompanyName,FullName" )to set up the _OL_ItemModify, finding nothing... just on that pc... my pc it works great and my MS7 pc runs great.. I guess I want to know if any bugs like that have been noted? Is there any suggestions to troubleshoot?

Link to comment
Share on other sites

You know that you can pass more than 10 properties to a function?

Just put all your properties in an array and pass it as $sOL_P1.

Example:

$oOutlook = _OL_Open()
$aFolder = _OL_FolderAccess( $oOutlook, "", $olFolderContacts )
Global $aProperties[15] = ["FullName=" & $con, "CompanyName=" & $company, "BusinessTelephoneNumber=" & $BusinessPhone, _
"BusinessAddressStreet=" & $address, "BusinessAddressCity=" & $city, "BusinessAddressState=" & $state, "BusinessAddressPostalCode=" & $zip, _
"BusinessAddressCountry=" & $country, "BusinessFaxNumber=" & $fax, "MobileTelephoneNumber=" & $cell, "Email1Address=" & $email, "Body=" & $body, "CustomerID=1"]
_OL_ItemCreate( $oOutlook, $olContactItem, $aFolder[1], "", $aProperties)

Empty elements in the array are ignored. So you can define an array with 100 elements and only use 20.

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

The problem with too many properties to pass to a function when creating/modifying an item was one of the reasons why the Outlook UDF has been extended to the OutlookEX UDF.

I hope to surprise you many more times :graduated:

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 haven't found a way to access the size via COM.

I will investigate the subject and come back with the results :graduated:

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

(As far as I know) Outlook doesn't seem to offer a way to programmatically access the size properties of a folder.

What you can do is use _OL_ItemFind to search a folder and all of its subfolders for e.g. mail items and return the size property of each mailitem. Then add up to the total size of the folder(s).

I don't know how accurate this approach will be. But that's how everyone else seems to calculate the size.

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

Hi,

Excellent script!

Question...I see where you can get a list of PST files, but is it possible to get a list of currently shared calendars...like the People's Calendars?

I also see that there is a $olCalendarSharing in OutlookEX.au3 which says 'Represents a CalendarSharing object', but I don't know how to use it.

Any help would be appreciated!

Thanks!

Link to comment
Share on other sites

Hi,

I will have a look how to enumerate shared calendars. It will take a few days before I can come up with a solution.

The $olCalendarSharing enumeration isn't used in the UDFat the moment. I just include the whole enumeration if I need a single value so a lot of them might be unused.

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 have come to the conclusion that I need to write a new function (_OL_FolderFind).

I'm off next week so it will take at least 10 days before I can come up with a solution.

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

Here is an example of the _OL_FolderFind function. Does this function offer what you need?

To get a list of all calendars in a folder structure you would call it like this:

$oOL = _OL_Open()
$aOL_Folders = _OL_FolderFind($oOL, "*", 99, "", 1, $olAppointmentItem)
_ArrayDisplay($aOL_Folders)
_OL_Close()
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

Hello Water,

First off awesome work on OutlookEX!

Been trying to get my script to send Thank you for your order Emails for my company.

So far I can get the mail to send and everything is great there.

My problem lies with the Warnings that pop up.

I have compiled the warnings script and placed it in the same dir.(desktop)

No errors, Simply doesn't do anything.

Let me know if you need any more info. I've tried to include everything.

Running outlook 2002 SP3

OutlookEX 2011-09-18 - Version 0.5.0

Here's the code I'm using.

#include <Excel.au3>
#include <OutlookEX.au3>
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
 
;_ExcelBookOpen(@DesktopDir & "\test.xls")
If WinExists("Microsoft Excel") Then
$oExcel = _ExcelBookAttach(@DesktopDir & "\test.xls")
Else
_ExcelBookOpen(@DesktopDir & "\test.xls")
$oExcel = _ExcelBookAttach(@DesktopDir & "\test.xls")
EndIf$oOL = _OL_Open(True)
$sTo = ""
$sSubject = "TEST EMAIL: Thank you for your recent Poster Art House Order"
$sBody = ""
For $i = 2 To 10000 ;Loop$sTo = _ExcelReadCell($oExcel, $i, 7)
$CustName = _ExcelReadCell($oExcel, $i, 8)
If $sTo = "" Then
  ConsoleWrite("Cell " & $i & " is Empty Assume Finished, Terminate Script" & @CR)
  Terminate()
EndIf
$sBody = "Dear " & $CustName & "," & @CRLF & @CRLF & "This is a test email for thanking customers for their Puchase" & @CRLF & "There will be a set format that uses their amazon contact info" & @CRLF & " " & @CRLF & @CRLF & "Love," & @CRLF & "David"
 
;**************************************
_OL_Wrapper_SendMail($oOL, $sTo, "", "", $sSubject, $sBody)If @error <> 0 Then
  MsgBox(16, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
  Exit
EndIf
MsgBox(64, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Mail successfully sent to user '" & $sTo & "'!")
Next
_OL_Close($oOL)
Func TogglePause()
$Paused = Not $Paused
While $Paused
  Sleep(100)
  ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
EndFunc   ;==>TogglePauseFunc Terminate()
MsgBox(0, "Done", "Cell Empty Assuming Done, Press OK to Exit")
_OL_Close($oOL)
Exit 0
EndFunc   ;==>Terminate
MsgBox(0, "Exiting", "Press OK to Exit")

A true renaissance man

Link to comment
Share on other sites

When the MsgBox "Mail successfully sent to user" pops up can you please check the task manager if there is a _OL_Warnings.exe running?

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

Next question: Is the title of the warning window "Microsoft Office Outlook"?

Edit:

Screenshots of the security warnings can be found here.

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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