I was wondering if some who is familiar with using Outlook along with CF could
take a look at this code. I have to try to create a task in Outlook via a cf
page and I found this code on CFCOMET but I get an error on the page. Do I
need to have Outlook installed on my CF server or can I connect to the users
Outlook running on their desktop. I have heard that this can be done in
VBScript but I have not seen any examples.
Here is the code that I got from CFCOMET:
CFTRY>
<!--- If it exists, connect to it --->
<CFOBJECT
ACTION=""
CLASS="Outlook.Application"
NAME="objOutlook"
TYPE="COM">
<CFCATCH>
<!--- The object doesn't exist, so create it --->
<CFOBJECT
ACTION=""
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("", "", 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=""> #iif(this.UnRead, DE("<B>#this.Subject#</B>"),
DE("#this.Subject#"))#
</A>
</TD>
</TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>
And this is the error message that I receive:
Error trying to create object specified in the tag.
COM error 0x800401F3. Invalid class string
The error occurred while processing an element with a general identifier of
(CFOBJECT), occupying document position (10:5) to (14:19) in the template file
G:\Inetpub\wwwroot\mario\test_outlook.cfm.
Date/Time: 02/27/04 19:29:16
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)
If anyone has any ideas on how to do this or if it is possible to do this with
Java instead. I tried this code on my CF4.5 dev box and my CF5.0 dev box but
not on my MX dev yet.
Thanks
Mario
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

