Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using CDO to access an Exchange 5.5 Server

Posted on 2004-04-14
4
Medium Priority
?
160 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 1500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Integration Management Part 2
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

886 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