Sign in to follow this  
Followers 0
water

OutlookEX UDF - Help & Support (II)

605 posts in this topic

As the OutlookEX UDF - Help & Support thread has grown too big, I'm starting a new one.

The original thread can be found


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites



I just discovered this UDF today first of all let me say thank you. As I also just discovered that CDO is not included in Outlook 2010 this has provided to be a tremendous help in converting an internal company utility from CDO.

What I've discovered however is that the OutlookEX does not support retrieving user defined properties on an item as a Return Property. This feature is seldom used but my company uses a CRM system that is integrated into Exchange/Outlook and relies heavily on custom properties. I am editing a copy of the OutlookEX for myself but it would be nice to see it supported natively through the UDF.

Instead of accessing a property via the standard way:

$oItem.ItemProperties.Item("Company").value

It is accessed via:

$oItem.UserProperties("IP Address").value

It would be nice to see a way to retrieve those properties, possibly by prefixing the property to know that a user-defined property is being retrieved ie: UserProperties("UP.IP Address"). More information can be found here: http://msdn.microsoft.com/en-us/library/office/bb177294(v=office.12).aspx

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

To add to that, User Properties do allow space characters as per the example above. I know that the current UDF functions are stripping spaces out of the ReturnArguments parameter in _OL_ItemFind

Edited by ChrisKite

Share this post


Link to post
Share on other sites

Correct, the UDF - at the moment - doesn't support user defined properties because it is rarely used.

If needed I willl be happy to add the needed functionality. It shouldn't be to complicated to modify _OL_ItemGet and _OL_ItemFind.

Did you already change all the needed functions? If yes I would be happy to see the code to add it to the UDF.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I'm still in the process of modifying it. There are many various lines that reference the standard .ItemProperties, and then a call to __OL_CheckProperties which has to be modified as well. However now I'm almost thinking it would be better to create a wrapper function for getting the property that would use the necessary call depending on whether it's a BuiltIn or User-Defined, as I'm finding myself having to add many If Then statements at various points in these functions.

I'm on holiday until next Wednesday but I'll tinker with it some more when I get back into the office, and then I can send you my modified file when done.

Share this post


Link to post
Share on other sites

I know. I didn't implement userproperties because it would have made the functions more complex.

Properties are queried/set in _OL_ItemCreate, _OL_ItemFind, _OL_ItemGet, _OL_ItemModify and __OL_CheckProperties.

Maybe some of the functions can be "optimized" so adding userproperties becomes a bit easier.

I will return from vacation on January the 16th and will then try to implement your code changes.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi again. I think that i have asked this question befor (or somthing like it) and i really need some help to get this gooing and i appritiate every bit of help that i can get.

My idee is to create a small GUI for our recptionsist. They need to keep track of all the meeting in all the rooms and therefor need to browse all the calenders. So what i want to do, is to get a list fo all the appointments in 15 diffrent calenders. Theese calenders are in the public folder, and thats what makes it hard.

I can use the following code to get all tyhe appointments from my own calender:

#include 
Global $oOutlook = _OL_Open()
$aResult = _OL_ItemFind($oOutlook, "*\Kalender", $olAppointment, "", "", "", "Subject,Start,End,Body", "", 2)
_arraydisplay($aResult)

The problem is that i cant get it to work in any of my calenders in the public folders

The path to the public folders is as follows:

Gemensamma mappar - *my mailadress*Alla gemensamma mapparfolder1Calender1

Gemensamma mappar - *my mailadress*Alla gemensamma mapparfolder1Calender2

Gemensamma mappar - *my mailadress*Alla gemensamma mapparfolder1Calender3 and so on.

gemsansamma mappar = public folders in swedish.

I tried to just switch the "*Kalender" to one of the above, i get a COm error: Description = Åtgärden misslyckades. Det gick inte att hitta ett objekt. (basicly translates to: Task faild, could not find an object).

Please. Any help would be greatly appritiated.

Share this post


Link to post
Share on other sites

Will try to help you next week - as soon as I return from vacation.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Great stuff ;) Take your time.

Share this post


Link to post
Share on other sites

The _OL_* functions don't support accessing all kind of folder types. Try _OL_FolderAccess and then pass the returned folder object to _OL_ItemFind.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Great UDF!

I can't wait to get this working. I currently have a working version of what I am doing in VB Script, however, we are making it a standalone executable for various reasons.

I have written quite a few scripts in AutoIt so I am fairly familiar with its language.

Here is my question:

I am using the below script to access a public folder on an exchange server. It works fine when I access a folder that is not protected. But, when I try to open a folder that is protected to only me, it returns that there are no mail items.

[/size]
$oOutlook = _OL_Open()
ConsoleWrite("_OL_Open: " & @error & @LF)
$Local_Folder = _OL_FolderAccess($oOutlook, "Path\To\Folder\With\Mail\Items")
ConsoleWrite("_OL_FolderAccess: " & @error &@extended & @LF)
$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "[UnRead]=True", "", "", "EntryID,SenderEmailAddress,Subject,Body")
;ConsoleWrite("_OL_ItemFind: " & @error & @LF)
;ConsoleWrite("_OL_ItemFind: " & $listofmail[0][0] & " items found" & @LF)

The folder opens and shows the unread messages inside when I use

_OL_ItemDisplay($oOutlook, $Local_Folder[1])

Pulling My Hair Out! What am I missing?

Thanks in advance!

Share this post


Link to post
Share on other sites

But, when I try to open a folder that is protected to only me, it returns that there are no mail items.

What do you mean by "protected"?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

The Exchange administrators have the ability to limit certain public folders to individuals and groups based on permissions

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

If it helps this is an example of what I was using in VB Script that worked:

Set allItemsFolder = GetFolder("Path\To\Messages")
Set objFolder = GetFolder("Path\To\Calendar")
Set sentFolder = GetFolder("Move\Messages\Here\After\Adding\To\Calendar")

For Each meetingRequest In allItemsFolder.Items

    Set gotoRequest = Application.CreateItem(olAppointmentItem)
    Set gotoRequest = objFolder.Items.Add(olAppointmentItem)

    body = meetingRequest.Body
    subject = meetingRequest.Subject


    gotoRequest.Subject = subject   
    gotoRequest.ReminderSet = True  
    gotoRequest.ReminderMinutesBeforeStart = 2880  
    gotoRequest.MeetingStatus = olMeeting
    
    sendtoFirstName = UCase(Mid(firstname, 1, 1))   
    gotoRequest.Body = meetingRequest.Body    
    gotoRequest.Start = startDay & " " & startTime  
    gotoRequest.End = startDay & " " & startTime  
    gotoRequest.Location = county & " County"
    gotoRequest.RequiredAttendees = sendtoLastName & ", " & sendtoFirstName
    gotoRequest.Save  
    gotoRequest.Send

    meetingRequest.UnRead = False  
    meetingRequest.Move sentFolder

Next meetingRequest


Function GetFolder(FolderPath)
  ' folder path needs to be something like
  '   "Public Folders\All Public Folders\Company\Sales"
  Dim aFolders
  Dim fldr
  Dim i
  Dim objNS

  ' On Error Resume Next
  strFolderPath = Replace(FolderPath, "/", "\")
  aFolders = Split(FolderPath, "\")

  'get the Outlook objects
  ' use intrinsic Application object in form script
  Set objNS = Application.GetNamespace("MAPI")

  'set the root folder
  Set fldr = objNS.Folders(aFolders(0))

  'loop through the array to get the subfolder
  'loop is skipped when there is only one element in the array
  For i = 1 To UBound(aFolders)
    Set fldr = fldr.Folders(aFolders(i))
    'check for errors
    If Err <> 0 Then Exit Function
  Next
  Set GetFolder = fldr

  ' dereference objects
  Set objNS = Nothing
End Function
Edited by idahoguy4life

Share this post


Link to post
Share on other sites

I am using the below script to access a public folder on an exchange server. It works fine when I access a folder that is not protected. But, when I try to open a folder that is protected to only me, it returns that there are no mail items.

$oOutlook = _OL_Open()
ConsoleWrite("_OL_Open: " & @error & @LF)
$Local_Folder = _OL_FolderAccess($oOutlook, "Path\To\Folder\With\Mail\Items")
ConsoleWrite("_OL_FolderAccess: " & @error &@extended & @LF)
$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "[UnRead]=True", "", "", "EntryID,SenderEmailAddress,Subject,Body")
;ConsoleWrite("_OL_ItemFind: " & @error & @LF)
;ConsoleWrite("_OL_ItemFind: " & $listofmail[0][0] & " items found" & @LF)
What's the value of @error after _OL_ItemFind?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

@error is 0

Also, something else I just recognized. It is not asking for permission to run the script in outlook like it normally does.

If I replace the public/folder/path with

$Local_Folder = _OL_FolderAccess($oOutlook, "\subfolder", $olFolderInbox)

Outlook asks for permission to run the script and correctly reads the items in the folder

I attempted to run _OL_FolderAccess with the enumerator $olPublicFoldersAllPublicFolders:

$Local_Folder = _OL_FolderAccess($oOutlook, "\Path\to\public\folder", $olPublicFoldersAllPublicFolders)

1. It doesn't recognize the variable $olPublicFoldersAllPublicFolders

2. When I define the variable with $olPublicFoldersAllPublicFolders = 18 it shows the array (with nothing in it) and it opens the public folder correctly but then gives me this in the console:

[size=4]_OL_FolderAccess: 00[/size]
COM Error Encountered in file.au3
OutlookEx UDF version = 0.9.0
@AutoItVersion = 3.3.6.1
@AutoItX64 = 0
@Compiled = 0
@OSArch = X86
@OSVersion = WIN_XP
Scriptline = 2514
NumberHex = 80020006
Number = -2147352570
WinDescription = Unknown name.
Description =
Source =
HelpFile =
HelpContext =
LastDllError = 0

Thanks for your help trying to figure this out!

Edited by idahoguy4life

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

If I manually try to access a public folder I have no permission to access I get the message "No elements can be displayed" (or something similar) and a white/red marquee at the top of the display pane.

So it looks like Outlook allow you to access the folder but doesn't show any content.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Right,

There are no errors thrown with accessing the folder. It is just not finding any of the content items.

But they are displayed with _OL_ItemDisplay($oOutlook, $Local_Folder[1]) so the path has to be right...

Share this post


Link to post
Share on other sites

What do you get if you try:

#include <OutlookEX.au3>
#include <Array.au3>
$oOutlook = _OL_Open()
ConsoleWrite("_OL_Open: " & @error & @LF)
$Local_Folder = _OL_FolderAccess($oOutlook, "Path\To\Folder\With\Mail\Items")
ConsoleWrite("_OL_FolderAccess: " & @error &@extended & @LF)
$listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "", "", "", "UnRead,EntryID,SenderEmailAddress,Subject,Body")
ConsoleWrite("_OL_ItemFind: " & @error & @LF)
_ArrayDisplay($listofmail)

Is the first column set to True for unread mails?

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Column 0 | 1

0 | 5

So that is a false...

Edited by idahoguy4life

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0