Jump to content

Recommended Posts

Posted

Hopefully you are still reading this thread. It seems your library is what I want to do the following:

-Take 3 parameters from command line (after compiling autoit script to exe) [ toAddress, subject, dateSent ]

-Look in Outlook's Sent Items folder for the matching message

-If found, open message on screen

-If not, return 1 to end the process

I have a real Outlook environment I'm running this against but I'm not familiar with how it wants the folder formatted. I'm guessing from examples that you need to us _OL_FolderAccess to get the identifier for the "Sent Items" folder and then _OL_ItemFind to match the message. This is the code I've put together

#include 
Global $oOutlook = _OL_Open()
Global $aFolder = _OL_FolderAccess($oOutlook, "Outlook\Sent Items")
Global $aItems = _OL_ItemFind($oOutlook, $aFolder, $olMail, "Subject=Re:&ToAddress=me@test.com&SentDate=2-4-12 3:02pm", "", "", "Subject,Body", "", 1)

If IsArray($aItems) Then
_ArrayDisplay($aItems, "Matching Email")
; Open $aItems[0]
Else
MsgBox(48, "Error")
return 1
EndIf

I know this is wrong, but I don't understand how outlook stores it's files or what "Sent Items" really is. You don't seem to mention it at all in your library.

Ideas?

Posted (edited)

Welcome to AutoIt and the forum.

You have a lot of errors in your script. Please read the help files that come with every function and the Wiki.

Try the following code. It is untested and the function to convert the EntryID to the $object is mssing. Can't test because I don't have Outlook at home.

#include <Outlook.au3>
Global $oOutlook = _OL_Open()
If @error Then Exit MsgBox(16, "Error", "Error returned by _OL_Open. @error = " & @error & ", @extended = " & @extended)
Global $aFolder = _OL_FolderAccess($oOutlook, "*Sent Items")
If @error Then Exit MsgBox(16, "Error", "Error returned by _OL_FolderAccess. @error = " & @error & ", @extended = " & @extended)
Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, "[Subject]='Re:' And [ToAddress]='me@test.com' And [SentDate]='2-4-12 3:02pm'", "", "", "EntryID,Subject,Body", "", 1)
If @error Then Exit MsgBox(16, "Error", "Error returned by _OL_ItemFind. @error = " & @error & ", @extended = " & @extended)
If IsArray($aItems) Then
    _ArrayDisplay($aItems, "Matching Email")
    $object.Display
Else
    MsgBox(48, "Error")
    return 1
EndIf
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

 

Posted

Hi all,

I'm trying to experiment with OutlookEX UDF. I'm trying to get a list of all the email items from a shared mailbox.

The name of the shared mailbox is: ICT Servicedesk (firstname: Servicedesk, Lastname: ICT)

I tried the following script:

#include <OutlookEX.au3>
Global $asUnreadmails[1], $asTemp, $iIndexFolder, $iIndexMail = 0, $iUnReadMails, $iIndexItem
Global $oOutlook = _OL_Open()
Global $asFolderList = _OL_FolderFind($oOutlook, "\\ICT Servicedesk\Inbox", 99, "", 1, $olMailItem)
For $iIndexFolder = 1 To $asFolderList[0][0]
    $iUnReadMails = $asFolderList[$iIndexFolder][0] .Items.Count
    If $iUnReadMails > 0 Then
ConsoleWrite($asFolderList[$iIndexFolder][0].Folderpath & " Number of unread mails: " & $asFolderList[$iIndexFolder][0].UnReadItemCount & @CRLF)
        ReDim $asUnreadmails[UBound($asUnreadmails) + $iUnReadMails]
        $asTemp = _OL_ItemFind($oOutlook, $asFolderList[$iIndexFolder][0], $olMail, "[UnRead]=True", "", "", "EntryID", "")
        For $iIndexItem = 1 To $asTemp[0][0]
            $iIndexMail += 1
            $asUnreadmails[$iIndexMail] = $asTemp[$iIndexItem][0]
        Next
    EndIf
Next

The script gives error:

Subscript used with non-Array variable.:
For $iIndexFolder = 1 To $asFolderList[0][0]
For $iIndexFolder = 1 To $asFolderList^ ERROR

When changing "\\ICT Servicedesk\Inbox" to "*" the script works fine. Got the script from a other topic. I think I'm doing something wrong with the shared mailbox.

Can you guys help me?

Thanks in advance!

Posted

Whats the error code returned by _OL_FolderFind? Insert the following MsgBox:

Global $asFolderList = _OL_FolderFind($oOutlook, "ICT ServicedeskInbox", 99, "", 1, $olMailItem)
MsgBox(0, "Error", @error)

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

 

Posted

Looks like it gives error 2.

2 - Error accessing the specified folder. See @extended for errorcode returned by _OL_FolderAccess

The extended error code is 1. I don't know what that means. Looks like the format is wrong. I tried all kind of formats for the email box, but can't get it to work. Any thoughts on this?

Thank you!

Posted

To access the folder of another user you should use something like this:

Global $aFolder = _OL_FolderAccess($oOutlook, "\\ICT Servicedesk\Inbox", $olFolderInbox)
if @error then MsgBox(0, "Error", "Error returned by _OL_FolderAccess: " & @error & "-" & @extended)
Global $asFolderList = _OL_FolderFind($oOutlook, $aFolder[1], 99, "", 1, $olMailItem)
if @error then MsgBox(0, "Error", "Error returned by _OL_FolderFind: " & @error & "-" & @extended)

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

 

Posted

Glad to be of service :D

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

 

Posted

Hi Water.

First of all great UDF. Ive used it for several scripts. But there is one thin that i cant get working. I want to access several calenders in our public folders and then create a simple list of all items in a few diffrent caladers.

But i cant get the _OL_FolderAccess part to work.

Ive got this code:

#Include <OutlookEX.au3>
#Include  <array.au3>

Global $oOutlook = _OL_Open()
$array =_OL_FolderAccess($oOutlook, "Gemensamma mappar - *my mailadress*")
_arraydisplay($array)
msgbox(0,@error,$array)
_OL_Close($oOutlook)

Im using a swedish version of Outlook 2010 and all the folders use the swedish name. Therefor the Public folders is called "gemensama mappar"

So how should i do the Folder Access so that get all the info in my public folders dir?

Posted

I am on vacation till the end of september. I will try to help you as soon as I return from Marocco.

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

 

Posted

Can you please run this modified version of your example code?

#Include <OutlookEX.au3>
Global $oOutlook = _OL_Open()
$array =_OL_FolderAccess($oOutlook, "\\Gemensamma mappar - *my mailadress*")
msgbox(0,"Error of _OL_FolderAccess", "@error: " & @error & ", @extended: " & @extended)
_OL_Close($oOutlook)

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

 

Posted

May I suggest an improvement to one of your functions?

It would be wonderful if _OL_ItemSave would allow some sort of flag to provide that the file created would have the date and time set to the same date and time as the email was sent or received. In this way, emails could be sorted in the directory by date and time and be in the correct order they were sent and received. Currently the file is saved with the date and time that the file is saved from outlook, rather than the sent or received date and time.

Thank you for this wonderful UDF.

Posted

Or you could use functions _OL_ItemGet to retrieve the send or receive date/time and then use function FileSetTime to set the date/time of the created file.

How about that?

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

 

Posted

I have been thinking about it and decided not to implement it in the UDF. You can achieve what you need with the "workaround" I described above. To handle send or receive date thew way you need it would bloat the function.

But if you like I can add the "workaround" to the example script.

Sorry for denying your request. If you have other requests I will be happy to consider.

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

 

  • 2 weeks later...
Posted

Version 0.9.0.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.

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

 

Posted (edited)

Can you please run this modified version of your example code?

#Include <OutlookEX.au3>
Global $oOutlook = _OL_Open()
$array =_OL_FolderAccess($oOutlook, "Gemensamma mappar - *my mailadress*")
msgbox(0,"Error of _OL_FolderAccess", "@error: " & @error & ", @extended: " & @extended)
_OL_Close($oOutlook)

I tried running this:

I got this response:

"@error: 1,@extended: 0"

Edited by Tjalve
Posted

I see. You have to pass the folder type when using this type of folder name

#Include <OutlookEX.au3>
Global $oOutlook = _OL_Open()
$array =_OL_FolderAccess($oOutlook, "\\Gemensamma mappar - *my mailadress*", $olFolderCalendar)
msgbox(0,"Error of _OL_FolderAccess", "@error: " & @error & ", @extended: " & @extended)
_OL_Close($oOutlook)

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

 

Posted

I tried but it doesnt matter what i enter in the folder part of the function. I always get an array witch containt 5 elemenst.

0 is a 5 (of course)

1 is empty

2 is just "0"

3 is a loooong string of numbers.

4 is also a long string of numbers (but not that long)

5 is *my emailadress*

I dont get it. I need to read the info in the calenders under "Gemensamma Mappar - *my emailadress* - Alla gemensamma mappar - folder1 - recption".

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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