Jump to content

OutlookEX UDF


water
 Share

Recommended Posts

My bad. The returned array is zero based, so element 0 doesn't contain a counter but the first folder address.
So the script should look like:

$aFol = _OL_FolderTree($oOutlook, "*\\Входящие\", 1)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing folder 'Outlook-UDF-Test'. @error = " & @error)
;_ArrayDisplay($aFol, "OutlookEX UDF: _OL_FolderTree Example Script - Tree starting with '*\Outlook-UDF-Test'")
For $i = 0 to UBound($aFol[0]) - 1
    _OL_FolderMove($oOutlook, $aFol[$i], "*\\Inbox")
    If @error Then MsgBox(16, "OutlookEX UDF: _OL_ItemCopy Example Script", "Error copying mail to another folder. @error = " & @error)
Next

 

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

How many entries does _ArrayDisplay show?

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

in my case:

Row|Col 0
[0]   |\\example@domain.ru\Входящие
[1]   |\\example@domain.ru\Входящие\Changesets
[2]   |\\example@domain.ru\Входящие\test1
[3]   |\\example@domain.ru\Входящие\test2

Link to comment
Share on other sites

I need a cup of coffee! I hope this works ;)

$aFol = _OL_FolderTree($oOutlook, "*\\Входящие\", 1)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing folder 'Outlook-UDF-Test'. @error = " & @error)
;_ArrayDisplay($aFol, "OutlookEX UDF: _OL_FolderTree Example Script - Tree starting with '*\Outlook-UDF-Test'")
For $i = 0 to UBound($aFol) - 1
    _OL_FolderMove($oOutlook, $aFol[$i], "*\\Inbox")
    If @error Then MsgBox(16, "OutlookEX UDF: _OL_ItemCopy Example Script", "Error copying mail to another folder. @error = " & @error)
Next

 

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

What is the value of @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

 

Link to comment
Share on other sites

Modify this line:

If @error Then MsgBox(16, "OutlookEX UDF: _OL_ItemCopy Example Script", "Error copying mail to another folder. @error = " & @error & ", @extended = " & @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

 

Link to comment
Share on other sites

On ‎26‎.‎01‎.‎2017 at 2:03 PM, david1337 said:

Yeah, if I can't avoid the crash with _OL_MailSignatureGet error handling in any way, it would have to use _OL_Open.
Problem with _OL_Open  is that if a user is starting up Outlook manually while _OL_Open is used, then Outlook closes again for that user.

I will try to see if I can fix the error handling of _OL_MailSignatureGet  somehow.

Thanks for your time water !

I think I know why _OL_MailSignatureGet crashes :huh: 
As we do not call _OL_Open there is no COM error handler in place. But all versions of AutoIt after 3.3.12.0 need a COM error handler to grab COM Errors. If there is none the script crashes.
As we do not want to call _OL_Open you simply could add

_OL_ErrorNotify(4)

at the top of your script.

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 think the double backslash in the target folder is incorrect (can't test at the moment). Could you please try:

_OL_FolderMove($oOutlook, $aFol[$i], "*\Inbox")

 

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

The same error(((

It looks like the function _OLFolderMove doesn`t gate the value $aFol. So the script gets the wrong value, different from \\example@domain.ru\Входящие\test1. When i write tis value directly to the _OL_FolderMove($oOutlook, "example@domain.ru\Входящие\test1", "*\\Inbox") it moves the folder without any error. Where to dig? How to pass values from the array correctly? The slashes don`t make any difference on the result

I tried to go another way. 

$aFolder = _OL_FolderFind($oOutlook, "*\\Входящие", 99, "", 2, $olMailItem)
If @error = 4 Then MsgBox(16, "OutlookEX UDF: _OL_FolderFind Example Script", "Error searching for folder. @error = " & @error & ", @extended = " & @extended)
;_ArrayDisplay($aFolder, "Folders searched by default item type")

For $i = 1 to $aFolder[0][0]
_OL_FolderMove($oOutlook, $aFolder[$i][1], "*\\Inbox")
If @error Then MsgBox(16, "OutlookEX UDF: _OL_ItemCopy Example Script", "Перемещение подпапок из папки Входящие не удалось. @error = " & @error & ", @extended = " & @extended)
Next

But get the same errors((( 1 and 1

Edited by bon3o
Link to comment
Share on other sites

Success!!! The point is that the array from 

_OL_FolderTree($oOutlook, "*\\Входящие\")

consists of folderpaths in "\\folder\folder"

But FolderMove exits with error in this case. It doesn`t work with "\\example@domain.ru\folder\folder" because of double slash(\\)

All i did is used _ArrayTrim($aFol, 2, 0) cut these two odd symbols. After that  the script works perfect! 

Thank you water for your patience and your help. It was a very usefull expirience for me))))

Below is the code that worked perfect for me:

Global $aVhod = _OL_FolderTree($oOutlook, "*\\Входящие\")
   If @error <> 0 Then Exit MsgBox(16, "Построение дерева папок", "Ошибка при построении дерева папок. @error = " & @error)
   _ArrayTrim($aVhod, 2, 0)
   _ArrayDelete($aVhod, '0')
      For $i = 0 to UBound($aVhod) - 1
      _OL_FolderMove($oOutlook, $aVhod[$i], "*\\Inbox")
      If @error Then MsgBox(16, "OutlookEX UDF: _OL_ItemCopy Example Script", "Перемещение подпапок из папки Входящие не удалось. @error = " & @error & ", @extended = " & @extended)
   Next

Edited by bon3o
Link to comment
Share on other sites

Use _OL_ItemFind to search for $olAppointment items.

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

Can you please post the part of your script where you call _OL_ItemFind?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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