Solved

Using CDO to access an Exchange 5.5 Server

Posted on 2004-04-14
4
151 Views
Last Modified: 2013-12-24
I found this code, which supposedly allows you to read inbox messages, at CFComet:

http://www.cfcomet.com/Outlook/index.cfm?ArticleID=54E12396-5696-11D3-B3E8004033E03EF9

But when I run it, I get this error:

An exception occurred when instantiating a Com object.  
The cause of this exception was that: coldfusion.runtime.com.ComObjectInstantiationException: An exception occurred when instantiating a Com object..  
 
The error occurred in X:\Dir\test3.cfm: line 21
Called from X:\Dir\test3.cfm: line 21
Called from X:\Dir\test3.cfm: line 21
 
19 :     <CFOBJECT
20 :         ACTION="CREATE"
21 :         CLASS="Outlook.Application"
22 :         NAME="objOutlook"
23 :         TYPE="COM">

0
Comment
Question by:fairoakian
  • 2
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Plucka
ID: 10829877
Hi fairoakian,

You need to have outlook installed on the server, do you have this.
0
 

Author Comment

by:fairoakian
ID: 10835673
I do now, thanks.  But the page just keeps loading and never loads.

<!--- Get the object --->
<CFTRY>
    <!--- If it exists, connect to it --->
    <CFOBJECT
        ACTION="CONNECT"
        CLASS="Outlook.Application"
        NAME="objOutlook"
        TYPE="COM">
  <CFCATCH>
    <!--- The object doesn't exist, so create it --->
    <CFOBJECT
        ACTION="CREATE"
        CLASS="Outlook.Application"
        NAME="objOutlook"
        TYPE="COM">
  </CFCATCH>
</CFTRY>

<CFSCRIPT>
    /* Get the object name space - currently MAPI is the only option */
     objNameSpace = objOutlook.getNameSpace("MAPI");

    /* If you're on Windows NT or 2000, use the next line */
     objNameSpace.Logon("user", "pwd", False, False);

    /* Set the folder to Inbox which is '6' */
     objFolder = objNameSpace.getDefaultFolder(6);

    /* Return the 'Items' collection */
     objAllMessages = objFolder.Items;
   
    /* Sort the messages by date descending */  
     objAllMessages.Sort("[ReceivedTime]", 1);
</CFSCRIPT>

<CFOUTPUT>
You have a total of #objAllMessages.Count# messages, #objFolder.UnreadItemCount# are unread:<P>

<TABLE CELLPADDING="2" CELLSPACING="1" BORDER="0" WIDTH="100%" BGCOLOR="gray">
    <TR BGCOLOR="ffffff">
        <TD><B>Sender</B></TD>
        <TD><B>Date</B></TD>
        <TD><B>Size</B></TD>
        <TD><B>Subject</B></TD>
    </TR>
<!--- Loop through the 'Messages' collection --->
<CFLOOP COLLECTION="#objAllMessages#" ITEM="this">
    <TR BGCOLOR="ffffff">
        <TD>#this.SenderName#</TD>
        <TD>#DateFormat(this.ReceivedTime, "ddd mm/dd")#</TD>
        <TD>#iif(this.size LT 1000, DE("#this.size#b"), DE("#Round(this.Size/1000)#k"))#</TD>
        <TD><A HREF="ViewMessage.cfm?entryID=#this.EntryID#">
            #iif(this.UnRead, DE("<B>#this.Subject#</B>"), DE("#this.Subject#"))#
            </A>
        </TD>
    </TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>
0
 
LVL 18

Accepted Solution

by:
Plucka earned 500 total points
ID: 10856654
fairoakian,

It's probably waiting for something, the mailbox would also have to be on the server. Best to go to the server console and run the page, you may see outlook spawn and give you some idea of why it's not finishing.

Regards
Plucka
0
 

Author Comment

by:fairoakian
ID: 10861325
Hmm...then this probably won't work for me.  I was hoping to use this for 30+ employees, but that doesn't appear plausible.  Thanks.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Internal DNS Zone Issue 13 73
LAMP problem identifier tool ? 9 118
UPLOAD FILE TO Web API USING POST 5 115
Webserver access problem 5 73
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question