Jump to content
Sign in to follow this  
water

OutlookEX UDF - Help & Support (II)

Recommended Posts

Hi again Water. You have helped me so mutch in the past so ive come to relay on your expertise in theese matters. As you probalbly know, im working on a mail archiving solution that uses outlook to dump all mail into a PST from a jornaling box. Evereything works great but sometimes there are hickups. So what i would like to do, is to check teh PST or any dublicates and delete them. No I was just wondering if you had any idees on how to do that. My idee for the moment is to use OL_ItemFind and get the HTML Body propertiy. Then compare every row in teh array, with all the other rows in the array. Since HTML Body is HUGE and we are talking about 100 000 mail in eatch PST. Thts probably not an option.

Im also wondering of there as any way to compare to PSTs and copy any mail thats not in the otherone and vise verse.

I know this is not an easy task, im just wondering of there is any way to acomplish this in under 6-8 hours. My current solution would take 2-3 days.

Share this post


Link to post
Share on other sites

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?

we are expanding peoples mailbox's from 200 meg to 1 Gig, running exchange 2007 and Windows xp and/or 7.

Basically, I want to have a script to hand to people, so they can open it, and it will simply display their current mailbox size. :-)

I'll probably end up looping it, so, they can keep it open and see their values change 'near' real time.

Share this post


Link to post
Share on other sites

Tjalve,

I would take Subject and ReceivedTime to identify a mail in your journal folder.

Take all mails (Subject,ReceivedDate,EntryID) from the journal folder and sort them by ReceivedDate. Take all mails from the PST (Subject,ReceivedDate) and sort them by ReceivedDate as well (make sure that when moving the mail from Exchange to PST the ReceivedDate doesn't change).

Then compare the ReceivedDate of first item from Exchange to the array of PST items. If the ReceivedDate of the PST entry is > the ReceivedDate of the Exchange Entry then the Exchange entry needs to be moved to the PST (then move to the next Exchange item). If < move to the next PST entry. If equal check the subject. If not equal move to the next PST entry. If equal move to the next Exchange item.

If the Exchange item has to be moved to the PST take the EntryID and move the item.

In this case you have to only process each item of the Exchagne array and the PST array once.

Just my 0,02$ worth.


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

BadGrim,

you could use a combination of PowerShell and VB. as described here.


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

Hmm. yeah that might be an idee. I guess i can insert the entire array into the array and then sort in with arrasort. Or can you sort it in the OL_ITEmFind directly?

Share this post


Link to post
Share on other sites

Tjalve,

sure _OL_ItemFind has a sort parameter.


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

Tjalve,

something like this:

Global $aExchange[6][3] = [["Subject1", 20130117180000, "EntryID1"],["Subject2", 20130117191500, "EntryID2"],["Subject3", 20130118090000, "EntryID3"],["Subject4", 20130118180000, "EntryID4"],["Subject5", 20130119074500, "EntryID5"],["Subject6", 20130119074500, "EntryID6"]]
Global $aPST[4][2] = [["Subject2", 20130117191500],["Subject3", 20130118090000],["Subject3", 20130118090000],["Subject5", 20130119074500]]
$iExchange = 0
$iPST = 0
While 1
    ConsoleWrite($aExchange[$iExchange][0] & ": " & $aExchange[$iExchange][1] & " - " & $aPST[$iPST][1] & @LF)
    If $aExchange[$iExchange][1] > $aPST[$iPST][1] Then ; Exchange date > PST date: Check next PST record
        ConsoleWrite("  Exchange > PST: Move " & $aExchange[$iExchange][0] & " and check next Exchange record" & @LF)
        $iExchange = $iExchange + 1 ; Check next Exchange record with next PST record
        $iPST = $iPST + 1
    ElseIf $aExchange[$iExchange][1] = $aPST[$iPST][1] Then ; Exchange date = PST date:
        If $aExchange[$iExchange][0] <> $aPST[$iPST][0] Then ; Different subject. Check next PST record
            ConsoleWrite("  Exchange = PST: Subject different - Check next PST record" & @LF)
            $iPST = $iPST + 1
        Else
            ConsoleWrite("  Exchange = PST: Subject equal - Check next Exchange record and next PST record" & @LF)
            $iExchange = $iExchange + 1 ; Equal subject. Check next Exchange record with next PST record
            $iPST = $iPST + 1
        EndIf
    Else ; Exchange date < PST date:
        If $iExchange = 0 Then ; Exchange date < PST date and first Exchange record: Move the Exchange record to the PST
            ConsoleWrite("  Exchange < PST: Move " & $aExchange[$iExchange][0] & " and check next Exchange record" & @LF)
            $iExchange = $iExchange + 1
        Else
            ConsoleWrite("  Exchange < PST: Check next PST record" & @LF)
            $iPST = $iPST + 1
        EndIf
    EndIf
    If $iExchange > UBound($aExchange, 1) - 1 Then ExitLoop
    If $iExchange <= UBound($aExchange, 1) - 1 And $iPST > UBound($aPST, 1) - 1 Then
        ConsoleWrite("  End of PST array: Move " & $aExchange[$iExchange][0] & @LF)
        ExitLoop
    EndIf
WEnd

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,

I am trying to use the sendmail command and am running into some issues sending and email with an attached file. There is most likely something wrong with my syntax here but I'm not finding it.

;Generate the email message and attach the letter
Local $mySubjectline = "My Subject Line"
Local $myEmailBody = "My Message Body Here"
Local $attachedFile = "C:\test.jpg"

$oOL = _OL_Open()
_OL_Wrapper_SendMail($oOL, $mySalesRep,"", "", $mySubjectline, $myEmailBody, $attachedFile)
_OL_Close()

I'm guessing I'm missing a required parameter in the _OL_Wrapper_SendMail(). My format appears to be correct from what I was looking at in this thread:

Any assistance is greatly appreciated.

-hogfan

Edited by hogfan

Share this post


Link to post
Share on other sites

What's the value of $mySalesRep?


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

After getting input from the user via an inputbox, the variable $mySalesRep will be the email address for the person to email. It is a Global variable outside of this function.

-hogfan

Share this post


Link to post
Share on other sites

Next question: What is the value of @error after you called function _OL_Wrapper_SendMail?


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

Before I am even calling the function I am getting a ton of errors in the OutlookEx.au3 at runtime.

I have

#include <OutlookEx.au3>

In the includes section of my script, and I copied the OutlookEx.au3 file into the includes directory as stated in the readme. Maybe I am missing something else. Sorry for the confusion.

A snippet of the errors I a seeing when trying to run my script are:

C:\Program Files\AutoIt3\Include\OutlookEx.au3(1160,20) : ERROR: $olJournalItem: undeclared global variable.
[$olJournalItem,
~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\OutlookEx.au3(1160,38) : ERROR: $olFolderJournal: undeclared global variable.
[$olJournalItem, $olFolderJournal]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\OutlookEx.au3(1160,52) : ERROR: $olMailItem: undeclared global variable.
[$olJournalItem, $olFolderJournal],[$olMailItem,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

-hogfan

Share this post


Link to post
Share on other sites

Did you copy OutlookEXConstants.au3 too?


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 looks like that was the issue, I copied that over and added it to the includes in my script. Thanks for the info.

-hogfan

Share this post


Link to post
Share on other sites

Looks like I need to update the installation instruction!


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

Let's say I have folder "Inbox" and It has subfolder "Subfolder". I need to put text of letters in "Subfolder" into the Array. For exemple $aArray[0] = "text of first letter", $aArray[1] = "text of second letter". How can I do it? Can you give me an exemple?

What do you mean by "letters"? Mail items? Attachments?

What do you mean by "text"? The mail subject, the body, the text of an attachment?


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

There are mails in the subfolder. I need to take their bodies into an array.

p.s I'm sorry. I think I have found worthy example:

$oOutlook = _OL_Open()
ConsoleWrite("_OL_Open: " & @error & @LF)
$Local_Folder = _OL_FolderAccess($oOutlook, "Path\Path")
ConsoleWrite("_OL_FolderAccess: " & @error &@extended & @LF)
$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "[UnRead]=True", "", "", "EntryID,SenderEmailAddress,Subject,Body")
Edited by minimen456

Share this post


Link to post
Share on other sites

Looks good!


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

The first array $listofmail was made with with _OL_ItemFind. And the second array was made with this code

Local $aArray[5] = ["LocoDarwin", "Jon", "big_daddy", "DaleHolm", "GaryFrost"]

Why can't I put first array into Excel Book with _ExcelWriteArray function(error: array variable has incorrect number of subscripts or subscript dimension range exceeded)? _ExcelWriteArray works OK with second array. Both arrays look the same to me. Any tips?

post-77820-0-16130400-1360325999_thumb.j

Edited by minimen456

Share this post


Link to post
Share on other sites

Can you please post the whole script? We need to know how you call _ExcelWriteArray and how you create/open the Excel workbook.


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