Search code examples
coldfusioncoldfusion-8

ColdFusion cfexchange connection and multiple mailboxes


So I'm working in ColdFusion 8, trying to grab the calendar/schedules from the Exchange server for several DIFFERENT users on the same page. Since you seem to only be able to specify the mailbox when opening the connection, it looks like I, unfortunately, have to open a new connection for each mailbox I wish to access. The problem is that, it appears that only the first connection I open works... any subsequent connections fail.

I have the following:

<cfloop list="mailbox1,mailbox2,mailbox3" index="mailboxname">

<cfexchangeconnection action="open" connection="conExchangeSchedules" 
    server="****"
    username="****"
    password="****"
    mailboxname="#mailboxname#"
    protocol="https"
formbasedauthentication="false">

<cfexchangecalendar
    action = "get"
    name = "qrySchedule"
    connection = "conExchangeSchedules">
        <cfexchangefilter name="StartTime" from="{ts '2013-01-06 00:00:00'}" to="{ts '2013-01-12 23:59:59'}">
</cfexchangecalendar>

<cfexchangeconnection action="close" connection="conExchangeSchedules">

<cfdump var="#qrySchedule#">

</cfloop>

Only the first mailbox is successful. I know all mailboxes are valid, because I've tried each one separately, and as the first value in the list.

But all other connections return the error

Could not login to the Exchange server.

Verify the server name, username, and password. Ensure that proper client certificates are installed.

Obviously not a helpful error, since the first connection works fine (thus "verifying" all the needed settings).

I've even tried to create each successive connection with a different name. Same issue.

Does anybody have any pointers or ideas?

Thanks in advance! -Carl


Solution

  • Answer for part of your question. You mentioned that you can only specify the mailboxName attribute in the cfexchangeconnection tag. Not necessarily... If you read the documentation for the cfexchangecalendar tag it contains this note (notice the 'If you omit the connection attribute..' statement):

    Note: For all actions, see cfexchangeconnection for additional attributes that you use if you do not specify the connection attribute. If you omit the connection attribute, create a temporary connection by specifying cfexchangeconnection tag attributes in the cfexchangecalendar tag. In this case, ColdFusion closes the connection when the tag completes. For details, see the cfexchangeconnection tag open action.

    So I read that to mean you can create a temporary connection to the Exchange server by including the cfexchangeconnection tag's open attributes in the cfexchangecalendar tag itself.

    Not sure if that will fix your other issue though.

    Referenced documentation for the cfexchangecalendar tag.