Jump to content
Sign in to follow this  
water

OutlookEX UDF - Help & Support (II)

Recommended Posts

Lets see if it works! Haven't tested it because I have no user forms.


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! Thank you for your great work. I’d like to ask a question about how to control Outlook. I need to do some clicking in the command menu (like: Tools-> Account Settings... -> Data Files - > Add... -> OK -> OK -> Close). Is it possible to do with your UDF?

Share this post


Link to post
Share on other sites

The UDF doesn't automate the GUI (command menu etc.) but uses COM to interact with Outlook. Not everything in Outlook can be automated using the UDF because not every function is made available by Microsoft via COM.

If you want to add a PST file use function _OL_PSTAccess.


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

Hello again. I have a quick Question. I have a script that dumps alot of mail to a PST (you helped me with it earlier. Thanx). Not the problem is that a problem with my storage solution made the program crash and the mailbox is now filled with over 500 000 mail. And the script is designed to use OL_ItemFind all mail in the inbox and move them to the PST. The problem is that the _OL_FindItem takes forever to go trough the 500 000 items. So the question is. Can you limit it to about 100? So when the array (returned by OL_ItemFind) only get to be 100 posts or 200 posts? That way ai can deal with some of the mail, little by little?

I tried using restructions like this: "[subject] > 'au' And [subject] < 'az'" but i still get over 7000 posts. Any idees? Thank you.

Share this post


Link to post
Share on other sites

Tjalve,

Not by the number of items returned. But you could limit the search by date. All mails received in January etc.


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

Ive tried toing that but coulden get it to work. Can you help me design a query that only returns the items that was recived in the last hour?

Im thinking like this:

$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "LAST HOUR", "", "", "EntryID")

if $listofmail[0][0] = 0 then

$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "LAST 2 HOURS", "", "", "EntryID")

if $listofmail[0][0] = 0 then

$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "LAST 3 HOURS", "", "", "EntryID")

endif

endif

So that first i dump all the mails from the last hour, and then the ones from 2 hours ago, and then 3 and so on. It may not be pretty but i cant have a larges span becuase there will be WAY to many mail for th fuction to handle.

Share this post


Link to post
Share on other sites

or pehaps you could use a while loop that increase the span for every run. Somthing like this perhaps?

$run = 1
while 1
$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "LAST $run HOURS", "", "", "EntryID")
if $listofmail[0][0] = 0 then
$run = $run + 1
else
$run = 1
endif
wend
Edited by Tjalve

Share this post


Link to post
Share on other sites

To get all mail items you received in January you would use the following script (Replace "Posteingang" with the name of your Inbox):

#include <OutlookEX.au3>

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

Global $aItems = _OL_ItemFind($oOutlook, "*\Posteingang", $olMail, "[ReceivedTime]>'2013-01-01 00:00' And [ReceivedTime]<'2013-01-31 23:59'", "", "", "Subject,ReceivedTime")
If IsArray($aItems) Then
_ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind Example Script")
Else
MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Could not find any mail. @error = " & @error & ", @extended: " & @extended)
EndIf

_OL_Close($oOutlook)

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

Alright. So based on this: "[ReceivedTime]>'2013-01-01 00:00' And [ReceivedTime]<'2013-01-31 23:59'"

Then this should oly take the mail from the last hour:

"[ReceivedTime]>'" & @year & "-"& @mon & "-"& @mday & " " & @HOUR & ":00' And [ReceivedTime]<'" & @year & "-"& @mon & "-"& @mday & " " & @HOUR & ":59'"

Right?

Share this post


Link to post
Share on other sites

Correct.


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

Thanx a MILION Water. I created a small while loop inside my main loop.

while 1
ConsoleWrite("Letar efter mail " & $hour + 1 & " timmar bakåt i tiden..." & @CRLF)
$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "[ReceivedTime]>'" & @year & "-"& @mon & "-"& @mday & " " & @HOUR +$hour & ":00' And [ReceivedTime]<'" & @year & "-"& @mon & "-"& @mday & " " & @HOUR & ":59'", "", "", "EntryID")
if $listofmail[0][0] = 0 Then
$hour = $hour + 1
Else
$hour = 0
ExitLoop
EndIf
WEnd

This code checks one hour back for new mail. If none is found, the search span increases to 2 hours, the 3 and so on. And It seems like its working great :)

Share this post


Link to post
Share on other sites

You have to substract the hours not add. You can't have any mails that you received one or multiple hours in the future.

You need something like this to calculate a correct date if you cross the date line (the example would list all items you received in the last 8 hours):

#include <date.au3>
$sNow = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":00:00"
ConsoleWrite("Now is:                      " & $sNow & @LF)
$sResult = _DateAdd("h", -8, @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":00:00")
ConsoleWrite("Now minus 8 hours is:      " & $sResult & @LF)
$sResult = StringReplace(StringLeft($sResult, 16), "/", "-")
ConsoleWrite("New Date for _OL_ItemFind is: " & $sResult & @LF)
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

yeah i found that my example above did not work. Ive recreated my script now and it increases by the hour first, and then by the day and then by the mon. Thanks again. You rock ;)

Share this post


Link to post
Share on other sites

Glad to be of service :D


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

haha come to think of it. is there a way to "Empty the trash" in a simple way? Instead of using _ol_itemfind on all the items in the deleted folder, and then delete every mail seperatly?

Share this post


Link to post
Share on other sites

Check the _OL_FolderDelete.au3 example script. Example 2 shows how to do.


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

Hello all,

I have used this udf in the past to create a script that disconnects all the pst files.

Now, i need to just check the 'folder size' for the current users mailbox as a whole, not just the inbox. The whole mailbox.

We are currently doing away with pst files and increasing users mailboxes to one gig. I just want to create a script that will simply display the size of their mailbox, so they do not go over their limit while migrating pst data into their core mailbox. Thoughts, suggestions?

Share this post


Link to post
Share on other sites

As far as I know there is now way to retrieve the folder size using COM.

Only way I see at the moment is to open the PST in a separate window using the OutlookEX UDF and then automate this window using plane AutoIt.


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

As far as I know there is now way to retrieve the folder size using COM.

Only way I see at the moment is to open the PST in a separate window using the OutlookEX UDF and then automate this window using plane AutoIt.

Im not looking for the size on the local pst file. Im looking for the size of the exchange mailbox (of course, I guess that may be a pst as well).

Share this post


Link to post
Share on other sites

Im not looking for the size on the local pst file. Im looking for the size of the exchange mailbox (of course, I guess that may be a pst as well).

The current size of the mailbox can be taken from Outlook as described above. BTW: An exchange mailbox is never a PST.

If you can retrieve the maximum allowed size (quota) depends on the Outlook, Exchange and Windows version you run. Can you please provide this information?


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
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...