Solved

Using CDO to access an Exchange 5.5 Server

Posted on 2004-04-14
4
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

628 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