If you are using Exchange 2000 or higher. It uses HTTP WEBDAV for most of its 
operations and uses a modified vCard and vCalendar for its store format (contacts & 
calendaring). Ximian's Exchange Connector for Evolution makes heavy use of IMAP and 
WEBDAV to manipulate OWA. Another option would be to abstract the OWA interface with a 
ASP (or Java a bit harder) web service that runs on the OWA box.


what are you trying to use OWA for?


I included at the end of the email is an ASP app and Jetspeed portlet for displaying 
some exchange data in the portal.

boyd




> -----Original Message-----
> From: Harald Ommang [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, February 25, 2004 9:33 AM
> To: [EMAIL PROTECTED]
> Subject: Re: MS exchange OWA and jetspeed
> 
> On Wed, 25 Feb 2004 15:26:35 +0100 (CET), Endre Stølsvik wrote:
> 
> > 
> > On Wed, 25 Feb 2004, Sezmillenium wrote:
> > 
> > | Thanks,
> > |     But, i want connect with java code and i want manage the 
> > | information to separete everything in a differents portlets... I 
> > | think that I need create some classes to work with this 
> information. 
> > | Somebody know another solution?
> > 
> > You're in for a treat!
> > 
> > If you come up with something, PLEASE let me know!
> > 
> > Here are a couple of hints along the way: Jacob, Jawin, JIntegra 
> > (commercial). Those are (D)COM bridges.
> > 
> > Endre
> > 
> 
> If you take a look at IBM's WPS portal catalog, you may get 
> some ideas.
> 
> Harald
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
>


---  MSExchangePortlet.xreg ----------


<?xml version="1.0" encoding="UTF-8"?>
<registry>
    <portlet-entry name="MSExchangePortlet" hidden="false" type="instance" 
application="false">
        <meta-info>
            <title>MS Exchange Connector</title>
            <description>Displays a user's MS Exchange (Outlook) unread mail status, 
tasks, and appointments.</description>
        </meta-info>
        <classname>mil.jfcom.cie.portal.portlets.MSExchangePortlet</classname>
        <parameter name="dont_remove_applet" value="yes" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="dont_remove_script" value="yes" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="dont_remove_noscript" value="yes" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="dont_remove_head" value="yes" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="dont_remove_style" value="no" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="dont_remove_meta" value="no" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="dont_remove_object" value="no" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="dont_remove_onsomething" value="no"
            hidden="true" cachedOnName="true" cachedOnValue="true"/>
        <parameter name="open_in_popup" value="no" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <parameter name="enableBasicAuth" value="yes" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <media-type ref="html"/>
        <url 
cachedOnURL="false">http://YOUR_EXCHANGE_SERVER_NAME/portletApp/portletApp.asp</url>
        <category group="Jetspeed">CIE</category>
    </portlet-entry>
</registry>

------------- MSExchangePortlet.java ----------------

/*
 *  ====================================================================
 *  The Apache Software License, Version 1.1
 *
 *  Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
 *  reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *  1. Redistributions of source code must retain the above copyright
 *  notice, this list of conditions and the following disclaimer.
 *
 *  2. Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in
 *  the documentation and/or other materials provided with the
 *  distribution.
 *
 *  3. The end-user documentation included with the redistribution,
 *  if any, must include the following acknowledgment:
 *  "This product includes software developed by the
 *  Apache Software Foundation (http://www.apache.org/)."
 *  Alternately, this acknowledgment may appear in the software itself,
 *  if and wherever such third-party acknowledgments normally appear.
 *
 *  4. The names "Apache" and "Apache Software Foundation" and
 *  "Apache Jetspeed" must not be used to endorse or promote products
 *  derived from this software without prior written permission. For
 *  written permission, please contact [EMAIL PROTECTED]
 *
 *  5. Products derived from this software may not be called "Apache" or
 *  "Apache Jetspeed", nor may "Apache" appear in their name, without
 *  prior written permission of the Apache Software Foundation.
 *
 *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *  DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 *  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 *  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 *  SUCH DAMAGE.
 *  ====================================================================
 *
 *  This software consists of voluntary contributions made by many
 *  individuals on behalf of the Apache Software Foundation.  For more
 *  information on the Apache Software Foundation, please see
 *  <http://www.apache.org/>.
 */
package mil.jfcom.cie.portal.portlets;

//Element Construction Set
import org.apache.jetspeed.util.JetspeedClearElement;
import org.apache.ecs.ConcreteElement;

//Jetspeed stuff
import org.apache.jetspeed.portal.portlets.AbstractInstancePortlet;
import org.apache.jetspeed.portal.PortletConfig;
import org.apache.jetspeed.portal.PortletException;
import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
import org.apache.jetspeed.services.logging.JetspeedLogger;
import org.apache.jetspeed.util.HTMLRewriter;
import org.apache.jetspeed.util.Base64;

//turbine
import org.apache.turbine.util.RunData;

//standard java stuff
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.net.URL;
import java.net.URLConnection;
import java.util.StringTokenizer;

/**
 * A class that loads a web page and filters it to have certain features
 * deleted.
 *
 * @author     <a href="mailto:[EMAIL PROTECTED]">Ingo Rammer</a>
 * @author     <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
 * @author     <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
 * @author     <a href="mailto:[EMAIL PROTECTED]">David G. Powers</a>
 * @author     <a href="mailto:[EMAIL PROTECTED]">Boyd Fletcher</a>
 * @created    August 6, 2003
 */
public class MSExchangePortlet extends AbstractInstancePortlet {
        /**
         * Static initialization of the logger for this class
         */
        private final static JetspeedLogger logger = 
JetspeedLogFactoryService.getLogger(MSExchangePortlet.class.getName());

        /**
         *  Description of the Field
         */
        protected HTMLRewriter rewriter = null;
        /**
         *  Description of the Field
         */
        protected boolean initDone = false;
        /**
         *  Description of the Field
         */
        protected boolean contentStale = true;
        /**
         *  Description of the Field
         */
        protected boolean cacheContent = false;
        /**
         *  Description of the Field
         */
        protected String username = null;
        /**
         *  Description of the Field
         */
        protected String password = null;


        /**
         * Initialize this portlet by defining a HTML rewriter.
         *
         * @throws  PortletException  Initialization failed
         */
        public void init() throws PortletException {

                if (initDone) {
                        // Why is init called more than once per portlet?
                        return;
                }

                PortletConfig config = this.getPortletConfig();

                try {
                        //FIXME: HTMLRewriter should take a Reader, and work
                        rewriter = new HTMLRewriter(
                                        !config.getInitParameter("dont_remove_script", 
"no")
                                        .equalsIgnoreCase("yes"),
                                        !config.getInitParameter("dont_remove_style", 
"no")
                                        .equalsIgnoreCase("yes"),
                                        
!config.getInitParameter("dont_remove_noscript", "no")
                                        .equalsIgnoreCase("yes"),
                                        !config.getInitParameter("dont_remove_meta", 
"no")
                                        .equalsIgnoreCase("yes"),
                                        !config.getInitParameter("dont_remove_applet", 
"no")
                                        .equalsIgnoreCase("yes"),
                                        !config.getInitParameter("dont_remove_object", 
"no")
                                        .equalsIgnoreCase("yes"),
                                        !config.getInitParameter("dont_remove_head", 
"no")
                                        .equalsIgnoreCase("yes"),
                                        
!config.getInitParameter("dont_remove_onsomething", "no")
                                        .equalsIgnoreCase("yes"),
                                        config.getInitParameter("open_in_popup", "no")
                                        .equalsIgnoreCase("yes")
                                        );

                        // fetch username and password for HTTP Basic Autentication
                        //username = config.getInitParameter("username");
                        //password = config.getInitParameter("password");

                        contentStale = true;
                        initDone = true;
                } catch (Exception e) {
                        logger.info("Exception occurred:" + e.toString());
                        e.printStackTrace();
                        throw new PortletException(e.toString());
                }
        }


        /**
         * took this from FileServerPortlet as it was private
         *
         * @param  url              Description of the Parameter
         * @return                  The reader value
         * @exception  IOException  Description of the Exception
         */
        // FIXME: Currently only the expiration the HTTP Reponse header is honored.
        //        Expiration information in <meta> tags are not honored
        protected Reader getReader(String url) throws IOException {
                URL pageUrl = new URL(url);

                URLConnection pageConn = pageUrl.openConnection();
                try {
                        // set HTTP Basic Authetication header if username and 
password are set
                        if (username != null && password != null) {
                                pageConn.setRequestProperty("Authorization", "Basic " +
                                                Base64.encodeAsString(username + ":" + 
password));
                        }
                } catch (Exception e) {
                        logger.info("Exception occurred:" + e.toString(), e);
                }

                long pageExpiration = pageConn.getExpiration();
                String encoding = "iso-8859-1";
                String contentType = pageConn.getContentType();
                String tempString = null;
                String noCache = "no-cache";

                if (contentType != null) {
                        StringTokenizer st = new StringTokenizer(contentType, "; =");
                        while (st.hasMoreTokens()) {
                                if (st.nextToken().equalsIgnoreCase("charset")) {
                                        try {
                                                encoding = st.nextToken();
                                                break;
                                        } catch (Exception e) {
                                                break;
                                        }
                                }
                        }
                }

                /*
                 *  Determing if content should be cached.
                 */
                cacheContent = true;
                // Assume content is cached
                if (pageExpiration == 0) {
                        cacheContent = false;
                }
                // Check header field CacheControl
                tempString = pageConn.getHeaderField("Cache-Control");
                if (tempString != null) {
                        if (tempString.toLowerCase().indexOf(noCache) >= 0) {
                                cacheContent = false;
                        }
                }
                // Check header field Pragma
                tempString = pageConn.getHeaderField("Pragma");
                if (tempString != null) {
                        if (tempString.toLowerCase().indexOf(noCache) >= 0) {
                                cacheContent = false;
                        }
                }

                // Assign a reader
                Reader rdr = new InputStreamReader(pageConn.getInputStream(),
                                encoding);

                // Only set the page expiration it the page has not expired
                if (pageExpiration > System.currentTimeMillis() && (cacheContent == 
true)) {
                        contentStale = false;
                        logger.debug("MSExchangePortlet caching URL: " +
                                        url +
                                        " Expiration: " +
                                        pageExpiration +
                                        ", " +
                                        (pageExpiration - System.currentTimeMillis()) +
                                        " milliseconds into the future");
                        setExpirationMillis(pageExpiration);
                } else {
                        contentStale = true;
                }

                return rdr;
        }


        /**
         *This methods outputs the content of the portlet for a given
         *request.
         *
         * @param  data  the RunData object for the request
         * @return       the content to be displayed to the user-agent
         */
        public ConcreteElement getContent(RunData data) {
                PortletConfig config = this.getPortletConfig();

                // if Basic Authentication is enabled, then get the username and 
password from the portlet registry
                // if username and password are not defined, then get the 
username/password for the logged in user.
                if 
(config.getInitParameter("enableBasicAuth","yes").equalsIgnoreCase("yes")) {
                        username = config.getInitParameter("username");
                        password = config.getInitParameter("password");
                        if (username == null || username.trim().length() == 0) {
                                username = data.getUser().getUserName();
                        }
                        if (password == null || password.trim().length() == 0) {
                                password = data.getUser().getPassword();
                        }
                }
                //logger.info("LOG-MSExchange Debug: username="+username+" 
password="+password);
                
                if (contentStale == true) {
                        return getWebPageContent(data, config);
                }

                if (null == getExpirationMillis()) {
                        return getContent(data, null, true);
                }

                if (getExpirationMillis().longValue() <= System.currentTimeMillis()) {
                        return getWebPageContent(data, config);
                }

                return getContent(data, null, true);
        }


        /**
         *  Gets the webPageContent attribute of the WebPagePortlet object
         *
         * @param  data    Description of the Parameter
         * @param  config  Description of the Parameter
         * @return         The webPageContent value
         */
        private ConcreteElement getWebPageContent(RunData data, PortletConfig config) {

                String convertedString = null;
                // parsed and re-written HTML
                JetspeedClearElement element = null;

                String url = selectUrl(data, config);

                try {
                        Reader htmlReader = getReader(url);
                        //FIXME: HTMLRewriter should take a Reader, and work
                        convertedString = rewriter.convertURLs(htmlReader, url);
                        element = new JetspeedClearElement(convertedString);

                        //FIXME: We should do a clearContent() for the media type, not 
ALL media types
                        this.clearContent();
                        // doing this because setContent() is not overwriting current 
content.
                        this.setContent(element);

                        htmlReader.close();

                } catch (Exception e) {
                        logger.info("Exception occurred:" + e.toString(), e);
                }

                return element;
        }


        /**
         * Usually called by caching system when portlet is marked as expired, but
         * has not be idle longer then TimeToLive.
         *
         * Any cached content that is expired need to be refreshed.
         */
        public void refresh() {
                if (cacheContent == true) {
                        getWebPageContent(null, this.getPortletConfig());
                }
        }


        /**
         * Select the URL to use for this portlet.
         *
         * @param  data    Description of the Parameter
         * @param  config  Description of the Parameter
         * @return         The URL to use for this portlet
         */
        protected String selectUrl(RunData data, PortletConfig config) {
                String url = config.getURL();

                return url;
        }
        // selectUrl

}


--------------- portletApp.asp ---------------



<!-- portletApp.asp
     Active Server Page (.asp) that performs the following functions:
     1) parses Exchange Web Store for unread messages in Inbox, Notes and Tasks folders
     2) displays current appointments
     3) displays open tasks
     
     Created By:  Armand J. "A.J." Nadeau
     Created On:  June 5, 2003
-->
<%@ Language=VBScript %>
<%

'get computer and domain information
Set info   = CreateObject("ADSystemInfo")
Set infoNT = CreateObject("WinNTSystemInfo")
cName = infoNT.ComputerName
dName = info.DomainDNSName

'create connection object
Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "Exoledb.DataSource"

'Get logon username data
strLogonUser = Request.ServerVariables("LOGON_USER")
intIndex = InStr(1, strLogonUser, "\")
if intIndex > 0 Then
        strLogonUser = mid(strLogonUser, intIndex + 1)
end if

'URL for connection object
'is at the virtual directory root
cURL = "http://"; & cName & "/exchange/" & strLogonUser

'Open connection to the Web store
Conn.Open cURL

'relative URL is the folder to search
relURL = "Inbox"
relURL2 = "Calendar"
relURL3 = "Tasks"
relURL4 = "Notes"

'date range variable:
dtmThisDay = Day(Now)
if dtmThisDay <= 9 Then
        dtmThisDay = "0" & dtmThisDay
end if
dtmThisMonth = Month(Now)
if dtmThisMonth <= 9 Then
        dtmThisMonth = "0" & dtmThisMonth
end if
'
' end date of date range is three days into the future
'
dtm3Day = Day(DateAdd("d",3,Now))
if dtm3Day <= 9 Then
        dtm3Day = "0" & dtm3Day
end if
dtm3Month = Month(DateAdd("d",3,Now))
if dtm3Month <= 9 Then
        dtm3Month = "0" & dtm3Month
end if
dtmThisYear = Year(Now)
dtm3Year = Year(DateAdd("d",3,Now))
dtmBegin = dtmThisYear & "-" & dtmThisMonth & "-" &  dtmThisDay & "T00:01:00Z"
dtmEnd = dtm3Year & "-" & dtm3Month & "-" &  dtm3Day & "T23:59:59Z"
DateRng1 = " >= CAST(""" & dtmBegin & """ as 'dateTime')"
DateRng2 = " <= CAST(""" & dtmEnd & """ as 'dateTime')"

FindUnreadMsgs relURL, Conn
FindApptByDate relURL2, DateRng1, DateRng2, Conn
FindTasks relURL3, Conn

'Sub to display count of unread messages
Sub FindUnreadMsgs (relURL, Conn)

        'Create recordset
        Set rs = CreateObject("ADODB.Recordset")
        
        'initialize the unread message count
        intUnread1 = 0
        
        ' Build the SQL query for the messages.
        strQ1 = "select "
        strQ1 = strQ1 & " ""urn:schemas:httpmail:read"""
        strQ1 = strQ1 & " from scope ('shallow traversal of "
        strQ1 = strQ1 & Chr(34) & relURL & Chr(34) & "') "
        strQ1 = strQ1 & " WHERE ""urn:schemas:httpmail:read"" = false"
        
        'Open the recordset
        Rs.Open strQ1, Conn
        
        'Get count of unread messages
        intUnread1 = Rs.RecordCount
        
        ' Close the recordset.
        Rs.Close
        
        ' Build the SQL query for the messages.
        strQ2 = "select "
        strQ2 = strQ2 & " ""urn:schemas:httpmail:read"""
        strQ2 = strQ2 & " from scope ('shallow traversal of "
        strQ2 = strQ2 & Chr(34) & relURL2 & Chr(34) & "') "
        strQ2 = strQ2 & " WHERE ""urn:schemas:httpmail:read"" = false"
        
        ' Open the recordset.
        Rs.Open strQ2, Conn
        
        'Get count of unread notes
        intUnread2 = Rs.RecordCount
        
        ' Close the recordset.
        Rs.Close
        
        'Open the recordset for Notes, initialize the unread messge count
        intUnread3 = 0
        
        ' Build the SQL query for the messages.
        strQ3 = "select "
        strQ3 = strQ3 & " ""urn:schemas:httpmail:read"""
        strQ3 = strQ3 & " from scope ('shallow traversal of "
        strQ3 = strQ3 & Chr(34) & strURL3 & Chr(34) & "') "
        strQ3 = strQ3 & " WHERE ""urn:schemas:httpmail:read"" = false"
        
        ' Open the recordset.
        Rs.Open strQ3, Conn
        
        'Get count of unread tasks
        intUnread3 = Rs.RecordCount
        
        ' Close the record and recordset.
        Rs.Close
        

        Response.Write "<b>Unread Messages:</b><br>"
        Response.Write "<TABLE BORDER=1 cellpadding=2 cellspacing=0 
bgcolor=#FFFFFF><TR>"
        Response.Write "<tr><td align=right>Inbox:</td><td align=right><b>" & 
intUnread1 & "</b></td></tr>" 
        Response.Write "<tr style=""width: 90px; vertical-align: 
middle;background-color: rgb(240, 240, 240);"">"
        Response.Write "<td align=right>Tasks:</td><td style=""text-align: right; 
width: 90px; vertical-align: middle;background-color: rgb(240, 240, 240);""  
align=right><b>" & intUnread2 & "</b></td></tr>"
        Response.Write "<tr><td align=right>Notes:</td><td align=right><b>" & 
intUnread3 & "</b></td></tr>"
        Response.Write "</TR></TABLE><br>"
End Sub

'Sub to query Calendar for current appointments
Sub FindApptByDate(relURL2, DateRng1, DateRng2, Conn)

     Const adErrNoCurrentRecord = 3021
     
     'Create recordset
     Set rs = CreateObject("ADODB.Recordset")

     'construct the SQL query
     strQ4 = "SELECT ""urn:schemas:httpmail:subject"", "
     strQ4 = strQ4 & " ""urn:schemas:calendar:dtstart"", "
     strQ4 = strQ4 & " ""urn:schemas:calendar:dtend"", "
     strQ4 = strQ4 & " ""urn:schemas:calendar:location"" "
     strQ4 = strQ4 & "FROM """ & relURL2 & """ "
     strQ4 = strQ4 & "WHERE ""urn:schemas:calendar:dtstart"" " & DateRng1
     strQ4 = strQ4 & "AND ""urn:schemas:calendar:dtend"" " & DateRng2
     strQ4 = strQ4 & "ORDER BY ""urn:schemas:calendar:dtstart"" ASC"
     
     'Open the connection to Exchange
     Rs.Open strQ4, Conn

     'Format date/time to be output
     'TBD
     
     'If empty recordset, return appropriate message
     'If successful, render results in browser
     If Rs.EOF = True Then
          On Error Resume Next
          Err.Raise adErrNoCurrentRecord
          Response.Write "<b>Current Appointments:</b><br>"
                          
          Response.Write "No Current Appointments<br><p>"
          
     Else
          Rs.MoveFirst
          Response.Write "<b>Current Appointments:</b><br>"
          Response.Write "<TABLE BORDER=1 cellpadding=2 cellspacing=0 
bgcolor=#FFFFFF>"           
          Response.Write "<tr><td align=center><b>Appointment Description & 
Time</b></td><td align=center><b>Location</b></td></tr>"'<td align=center><b>StartTime 
(GMT)</b><br><hr><b>End Time (GMT)</b></td></tr>"
          colorBar=240
          do until Rs.EOF
                  if colorBar = 255 then
                      colorBar = 240
                  else 
                      colorBar = 255
                  end if  
                  Response.Write "<tr style=""width: 90px; vertical-align: 
middle;background-color: rgb("&colorBar&", "&colorBar&","&colorBar&");"" >"
                  strStartApptTime = Rs.Fields("urn:schemas:calendar:dtstart").Value
                  strEndApptTime = Rs.Fields("urn:schemas:calendar:dtend").Value
                  Response.Write "<td>&nbsp;" & 
Rs.Fields("urn:schemas:httpmail:subject").Value & "<br><i>" & strStartApptTime & 
"&nbsp;-&nbsp;" & strEndApptTime & "</i></td>"
                  Response.Write "<td>&nbsp;" & 
Rs.Fields("urn:schemas:calendar:location").Value & "</td>"
                  'strStartApptTime = 
Right(Rs.Fields("urn:schemas:calendar:dtstart").Value, 11)
                  'strStartApptTime = Rs.Fields("urn:schemas:calendar:dtstart").Value
                  'strEndApptTime = Rs.Fields("urn:schemas:calendar:dtend").Value
                  'Response.Write "<td>" & strStartApptTime & " -- " & strEndApptTime 
& "</td></tr>"
                  'Response.Write "<td align=center>" & strStartApptTime & "<br><hr>" 
& strEndApptTime & "</td></tr>"
          Rs.MoveNext
          loop
          Response.Write "</TABLE><br>"
     End If
     Rs.Close

End Sub

'Sub to query for pending Tasks
Sub FindTasks(relURL3, Conn)

     Const adErrNoCurrentRecord = 3021

     Set rs = CreateObject("ADODB.Recordset")

     'construct the SQL query, sort results by ascending date
     strQ5 = "SELECT ""urn:schemas:httpmail:subject"", "
     strQ5 = strQ5 & " ""urn:schemas:httpmail:importance"", "
     strQ5 = strQ5 & " ""http://schemas.microsoft.com/mapi/commonend""; "
     strQ5 = strQ5 & "FROM """ & relURL3 & """ "
     strQ5 = strQ5 & "ORDER BY ""http://schemas.microsoft.com/mapi/commonend""; ASC"
     
     'Open the connection to Exchange
     Rs.Open strQ5, Conn
     
     'If empty recordset, return appropriate message
     'If successful, render results in browser
     If Rs.EOF = True Then
          On Error Resume Next
          Err.Raise adErrNoCurrentRecord
          Response.Write "<b>Pending Tasks:</b><br>"
          Response.Write "No Pending Tasks<br><p>"
     Else
          Rs.MoveFirst
          Response.Write "<b>Pending Tasks:</b><br>"
          Response.Write "<TABLE BORDER=1 cellpadding=2 cellspacing=0 bgcolor=#FFFFFF>"
          Response.Write "<tr><td align=center><b>Task</b></font></td>"
          Response.Write "<td align=center><b>Priority</b></td>"
          Response.Write "<td align=center><b>Due Date</b></td></tr>"
          colorBar=240
          do until Rs.EOF
                  if colorBar = 255 then
                      colorBar = 240
                  else 
                      colorBar = 255
                  end if  
                  Select Case Rs("urn:schemas:httpmail:importance")
                        Case 2
                                strI = "High"
                        Case 1
                                strI = "Normal"
                        Case 0
                                strI = "Low"
                End Select
                Response.Write "<tr style=""width: 90px; vertical-align: 
middle;background-color: rgb("&colorBar&", "&colorBar&","&colorBar&");"">"
                Response.Write "<td>&nbsp;" & 
Rs.Fields("urn:schemas:httpmail:subject").Value & "</td>"
                Response.Write "<td>&nbsp;" & strI & "</td>"
                intDue = 
Len(Rs.Fields("http://schemas.microsoft.com/mapi/commonend";).Value)
                Select Case intDue
                        Case 21
                                strDue = 
Left(Rs.Fields("http://schemas.microsoft.com/mapi/commonend";).Value, 10)
                        Case 20
                                strDue = 
Left(Rs.Fields("http://schemas.microsoft.com/mapi/commonend";).Value, 9)
                        Case 19
                                strDue = 
Left(Rs.Fields("http://schemas.microsoft.com/mapi/commonend";).Value, 8)
                End Select
                if Rs.Fields("http://schemas.microsoft.com/mapi/commonend";).Value <> 
"" Then                                                      
                        Response.Write "<td>&nbsp;" & strDue & "</td></tr>"
                else
                        Response.Write "<td>None</td></tr>"
                End If
          Rs.MoveNext
          loop
          Response.Write "</TABLE><p>"
     End If
     Rs.Close

End Sub
%>





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to