XWEB: How to Create a Sent Items View in Outlook Web Access
ID: Q237430
|
The information in this article applies to:
-
Microsoft Outlook Web Access, version 5.5
SUMMARY
This article describes one way of customizing OWA ASP scripts to create a Sent Items view, that is, one which shows the message recipient instead of the message sender, and the submitted date instead of the received date.
The following Microsoft Knowledge Base articles (for example) describe how you can make Exchange Server or Outlook folder views available to Outlook Web Access (OWA) clients. However, all of these require that you use a MAPI client.
Q175114 XWEB: Cannot Access Custom Views Created with Outlook in OWA
Q176034 XWEB: Outlook View Does Not Appear in OWA View List
Q186442 XWEB: Exchange Personal Views Not Available in Outlook or Outlook Web Access Client
The customizations described below are just an example of what can be done; it may well be possible to improve on this solution.
MORE INFORMATION
The customization involves changes to one of the supplied ASP files, and the
creation of a new ASP file.
The file that you need to change is the Messages.asp file, located in the
Exchsrvr\Webdata\language\Inbox directory. Make a backup of this file
before you change it.
The first line of the script is:
On Error Resume Next
Immediately after this, add two extra lines, so it reads as follows:
On Error Resume Next
Set objStore = Session(bstrObjPrivateStore)
Set objFolder = SESSION(CURRENT_FOLDER)
Further down, you see:
If urlObj <> "" then
Set objRenderer = GetMessagesRenderer(fNew)
CheckPage objRenderer
Change this to read:
If urlObj <> "" then
If urlObj =
(objStore.Fields.Item(ActMsgPR_IPM_SENTMAIL_ENTRYID).Value) Then
Set objRenderer = GetSentItemsRenderer (objFolder)
Else
Set objRenderer = GetMessagesRenderer(fNew)
End If
CheckPage objRenderer
Now, create a new file to contain the new GetSentItemsRenderer function. Call it the Sentitems.inc file, and locate it in the Exchsrvr\Webdata\language\Lib directory. Add the Sentitems.inc file to the list of #include files at the top of the amended Messages.asp file.
The new Sentitems.inc file looks like this:
<!--#include file="render.inc"-->
<!--#include file="store.inc"-->
<%
'!--Microsoft Outlook Web Access-->
'!--SentItems.inc - functions to render a Sent Items folder-->
'!--Copyright (c) Microsoft Corporation 1993-1999. All rights reserved.-->
'=======================
' GetSentItemsRenderer
'
' Returns: rendering object for Sent Items folder,
' which displays Recipient info instead of From
'=======================
Public Function GetSentItemsRenderer (objFolder)
On Error Resume Next
Set GetSentItemsRenderer = Nothing
If fPlainText Then
strEOL = vbCrLf
Else
strEOL = "<br>" & vbCrLf
End If
Set objRenderApp = Application (bstrRenderApp)
If objRenderApp Is Nothing Then
ReportError1 L_errFailedToCreateApp_ErrorMessage
End If
' Note: this Container renderer (3) is not cached in the session
Set objRenderer = objRenderApp.CreateRenderer (3)
If objRenderer Is Nothing Then
ReportError1 L_errFailedToCreateApp_ErrorMessage
End If
' cache the private store, if there is one
If (Session(bstrAuthenticated)) Then
objRenderer.PrivateStore = objOMSession.GetInfoStore(objOMSession.Inbox.StoreID)
If (Err.Number <> 0) Then
ReportError1 L_errFailedToGetInbox_ErrorMessage
End If
End If
' set the language
objRenderer.CodePage = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
If (Not objRenderer Is Nothing) Then
' set up the view
Set objView = objRenderer.Views.Add ("Sent Items")
objRenderer.TablePrefix = "<table border=0 cellspacing=0 cellpadding=1 WIDTH=""100%"" >"
objRenderer.TableSuffix = "</table>"
objRenderer.HeadingRowPrefix = "<tr bgcolor=#c0c0c0>"
objRenderer.HeadingRowSuffix = "</tr>"
objRenderer.HeadingCellPattern = "%value%"
objRenderer.RowPrefix = "<tr>"
objRenderer.RowSuffix = "</tr>"
objRenderer.CellPattern = ""
bstrImgSrc = "<IMG SRC=" + bstrVirtRoot
' Apply check box as first column
Set objFormat = objRenderer.Formats.Add(ActMsgPR_ROWID, Null)
objFormat.Patterns.Add "*", "<INPUT name=%value% value=%obj% type=checkbox>"
ApplyCheckBoxColumn(objRenderer)
'priority
Set objColumn = objView.Columns.Add("<IMG SRC=../images/urgent.gif HEIGHT=16 WIDTH=13>", ActMsgPR_IMPORTANCE, 2, 0, 1)
Set objFormat = objRenderer.Formats.Add(ActMsgPR_IMPORTANCE, Null)
Set objPatterns = objFormat.Patterns
bstrHTML = bstrImgSrc + "/images/low.gif WIDTH=13 HEIGHT=16 BORDER=0>"
objPatterns.Add 0, bstrHTML
objPatterns.Add 1, ""
bstrHTML = bstrImgSrc + "/images/urgent.gif WIDTH=13 HEIGHT=16 BORDER=0>"
objPatterns.Add 2, bstrHTML
'message class
Set objColumn = objView.Columns.Add("<IMG SRC=../images/freedoc.gif HEIGHT=16 WIDTH=14>", ActMsgPR_MESSAGE_CLASS, 2, 0, 2)
Set objFormat = objRenderer.Formats.Add(ActMsgPR_MESSAGE_CLASS, Null)
Set objPatterns = objFormat.Patterns
bstrHTML = bstrImgSrc + "/images/envelope.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Note", bstrHTML
bstrHTML = bstrImgSrc + "/images/encrypt.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Note.Secure", bstrHTML
bstrHTML = bstrImgSrc + "/images/digi_sig.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Note.Secure.Sign", bstrHTML
bstrHTML = bstrImgSrc + "/images/smime.gif WIDTH=15 HEIGHT=14 BORDER=0>"
objPatterns.Add "IPM.Note.SMIME", bstrHTML
bstrHTML = bstrImgSrc + "/images/smimesig.gif WIDTH=15 HEIGHT=13 BORDER=0>"
objPatterns.Add "IPM.Note.SMIME.MultipartSigned", bstrHTML
bstrHTML = bstrImgSrc + "/images/oof.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Note.Rules.OofTemplate.Microsoft", bstrHTML
bstrHTML = bstrImgSrc + "/images/post.gif WIDTH=16 HEIGHT=15 BORDER=0>"
objPatterns.Add "IPM.Post", bstrHTML
bstrHTML = bstrImgSrc + "/images/icontact.gif WIDTH=16 HEIGHT=12 BORDER=0>"
objPatterns.Add "IPM.Contact", bstrHTML
bstrHTML = bstrImgSrc + "/images/freedoc.gif WIDTH=16 HEIGHT=15 BORDER=0>"
objPatterns.Add "IPM.Document.*", bstrHTML
bstrHTML = bstrImgSrc + "/images/mtgreq.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Schedule.Meeting.Request", bstrHTML
bstrHTML = bstrImgSrc + "/images/mtgcancl.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Schedule.Meeting.Canceled", bstrHTML
bstrHTML = bstrImgSrc + "/images/mtgaccpt.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Schedule.Meeting.Resp.Tent", bstrHTML
bstrHTML = bstrImgSrc + "/images/mtgaccpt.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Schedule.Meeting.Resp.Pos", bstrHTML
bstrHTML = bstrImgSrc + "/images/mtgdecln.gif WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "IPM.Schedule.Meeting.Resp.Neg", bstrHTML
bstrHTML = bstrImgSrc + "/images/ipnrn.gif WIDTH=16 HEIGHT=11 BORDER=0>"
objPatterns.Add "*IPNRN", bstrHTML
bstrHTML = bstrImgSrc + "/images/ipnnrn.gif WIDTH=16 HEIGHT=11 BORDER=0>"
objPatterns.Add "*IPNNRN", bstrHTML
bstrHTML = bstrImgSrc + "/images/ndr.gif WIDTH=16 HEIGHT=11 BORDER=0>"
objPatterns.Add "*NDR", bstrHTML
bstrHTML = bstrImgSrc + "/images/dr.gif WIDTH=16 HEIGHT=11 BORDER=0>"
objPatterns.Add "*DR", bstrHTML
bstrHTML = bstrImgSrc + "/forms/%classpath%icon.jpg WIDTH=16 HEIGHT=16 BORDER=0>"
objPatterns.Add "*", bstrHTML
'attachments
Set objColumn = objView.Columns.Add("<IMG SRC=../images/papclip.gif HEIGHT=18 WIDTH=10>", ActMsgPR_HASATTACH, 2, 0, 3)
Set objFormat = objRenderer.Formats.Add(ActMsgPR_HASATTACH, Null)
Set objPatterns = objFormat.Patterns
objPatterns.Add 0, ""
bstrHTML = bstrImgSrc + "/images/papclip.gif WIDTH=10 HEIGHT=14 BORDER=0>"
objPatterns.Add 1, bstrHTML
' Sent To
Set objColumn = objView.Columns.Add("To", ActMsgPR_DISPLAY_TO, 25, 0, 4)
Set objFormat = objRenderer.Formats.Add(ActMsgPR_DISPLAY_TO, Null)
objFormat.Patterns.Add "*", "<FONT SIZE=2 " + bstrFace + ">%value%</FONT>"
'subject
Set objColumn = objView.Columns.Add("Subject", ActMsgPR_SUBJECT, 50, 0, 5)
Set objFormat = objRenderer.Formats.Add(ActMsgPR_SUBJECT, Null)
objFormat.Patterns.Add "*", "<FONT SIZE=2 " + bstrFace + ">%value%</FONT>"
'Sent Time
Set objColumn = objView.Columns.Add("Sent At", ActMsgPR_CLIENT_SUBMIT_TIME, 15, 0, 6)
Set objFormat = objRenderer.Formats.Add(ActMsgPR_CLIENT_SUBMIT_TIME, Null)
objFormat.Patterns.Add "*", "<FONT SIZE=2 " + bstrFace + ">%value%</FONT>"
'size
Set objColumn = objView.Columns.Add("Size", ActMsgPR_MESSAGE_SIZE, 8, 0, 7)
Set objFormat = objRenderer.Formats.Add(ActMsgPR_MESSAGE_SIZE, Null)
objFormat.Patterns.Add "*", "<FONT SIZE=2 " + bstrFace + ">%kvalue%"+L_Kilobytes_Text+"</FONT>"
If (Session(bstrAuthenticated)) Then
bstrHTML = "<A HREF='JavaScript:parent.openNewWindow(""" + bstrVirtRoot + "/forms/%classpath%frmRoot.asp?index=%rowid%&obj=%obj%&command=open"", ""%obj%"", 640, 500)'>%value%</A>"
Else
bstrHTML = "<A HREF='JavaScript:parent.openNewWindow(""" + bstrVirtRoot + "/forms/%classpath%frmRoot.asp?index=%rowid%&obj=%obj%&acs=anon&command=open"", ""%obj%"", 640, 500)'>%value%</A>"
End If
objRenderer.LinkPattern = bstrHTML
Set objPatterns = Nothing
End If
' set up the rows per page
cRows = CInt(Request.QueryString("rows"))
If cRows < 1 Then
cRows = iDefaultNumRows
End If
objRenderer.RowsPerPage = cRows
' Finally set the datasource and current view
objRenderer.DataSource = objFolder.Messages
objRenderer.CurrentView = objRenderer.Views.Count
Set GetSentItemsRenderer = objRenderer
End Function
'=======================
' ApplyCheckBoxColumn
'=======================
Sub ApplyCheckBoxColumn(objRenderer)
On Error Resume Next
If (Session(bstrAuthenticated)) Then
Set objViews = objRenderer.Views
If Err.Number <> 0 Then
ReportError1 L_errFailGetViews_ErrorMessage
Else
nViews = objViews.Count
For iView = 1 To nViews
Set objView = objViews.Item(iView)
If objView.Source = AMHTML_View_Custom Then
'Add column header for checkbox
' 4 is the column width
if not (objView.Columns(1).property = ActMsgPR_ROWID OR objView.Columns(2).property = ActMsgPR_ROWID) then
Flags = AMHTML_Column_CenterJustify Or AMHTML_Column_NotSortable Or AMHTML_Column_Bitmap
Set objColumn = objView.Columns.Add("<IMG SRC=../images/mark.gif HEIGHT=13 WIDTH=13>", ActMsgPR_ROWID, 13, Flags, objView.Categories)
end if
End If
Next
End If
End If
End Sub
%>
Additional query words:
Keywords :
Version : WINDOWS:5.5
Platform : WINDOWS
Issue type : kbhowto