Solved

Using CDO to access an Exchange 5.5 Server

Posted on 2004-04-14
4
154 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 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