<%
Case "save"
Set objNewMsg = Session(bstrobj)
BindData
If Len(fm__szErrMsg) = 0 Then 'field validation failed so don't save
fm__szErrMsg = ValidateRequiredFields()
If Len(fm__szErrMsg) = 0 Then 'everything hunky-dory
Err.Clear
If objNewMsg.Attachments.Count <> 0 then
objNewMsg.Text = vbCrLf + objNewMsg.Text
End If
objNewMsg.Type = "IPM.Contact.Candidate"
strUserName = objOMSession.CurrentUser.Name
objNewMsg.Fields(ActMsgPR_SENT_REPRESENTING_NAME) = strUserName
objNewMsg.Fields(ActMsgPR_SENT_REPRESENTING_EMAIL_ADDRESS) =
objOMSession.CurrentUser.Address
objNewMsg.Fields(ActMsgPR_SENT_REPRESENTING_ADDRTYPE) =
objOMSession.CurrentUser.Type
objNewMsg.TimeReceived = Now
objNewMsg.TimeSent = Now
objNewMsg.Sent = True
objNewMsg.Submitted = True
objNewMsg.Unread = False
objNewMsg.Update
If Err.Number <> 0 Then
If MAPI_E_NO_ACCESS = Err.Number Then
'You do not have permission to create items in this folder.
MessageSent="error"
AlertMessage = L_errCreateItemPermision_ErrorMessage
Else
'There were problems sending the message. Try again or cancel.
MessageSent="error"
AlertMessage = L_errMessage004_ErrorMessage
End If
Else
MessageSent="save"
End If
End If
End If
%>
Figure 12 Using the CDO Rendering Library
<%
'Get the Application Renderer
set oRenderApp = Application("RenderApplication")
'Create a new renderer
set oRenderer = oRenderapp.CreateRenderer(3)
set oMessages = oCurrentFolder.Messages
oRenderer.Datasource = oMessages
oRenderer.CurrentStore = oSession.GetInfoStore(oCurrentFolder.StoreID)
set oViews = oRenderer.Views
oRenderer.LinkPattern = "<A HREF=" & chr(34) & _
"JavaScript:openNewWindow('/exchange/forms/openitem.asp?obj=%obj%', _
'newMessageWindow', 650, 350)" & Chr(34) & ">" & "%value%" & "</A>"
set oFormats = oRenderer.Formats
'attachments
Set oFormat = oRenderer.Formats.Add(ActMsgPR_HASATTACH, Null)
Set oPatterns = oFormat.Patterns
oPatterns.Add 0, ""
bstrHTML = "<IMG SRC=papclip.gif WIDTH=10 HEIGHT=14 BORDER=0>"
oPatterns.Add 1, bstrHTML
Set oFormat = oRenderer.Formats.Add(ActMsgPR_MESSAGE_SIZE, Null)
oFormat.Patterns.Add "*", "%kvalue%KB"
Set oFormat = oRenderer.Formats.Add(ActMsgPR_IMPORTANCE, Null)
set oPatterns = oFormat.Patterns
bstrHTML = "<IMG SRC=low.gif WIDTH=13 HEIGHT=16 BORDER=0>"
oPatterns.Add 0, bstrHTML
oPatterns.Add 1, ""
bstrHTML = "<IMG SRC=urgent.gif WIDTH=13 HEIGHT=16 BORDER=0>"
oPatterns.Add 2, bstrHTML
Set oFormat= oRenderer.Formats.Add( ActMsgPR_MESSAGE_CLASS)
Set oPatterns= oFormat.Patterns
oPatterns.Add "IPM.Contact.*", "<IMG SRC=icon.jpg VALIGN=absmiddle>"
oPatterns.Add "IPM.Document.Word.*", "<IMG SRC=iword.gif VALIGN=absmiddle>"
oPatterns.Add "IPM.Document.Excel.*", "<IMG SRC=iexcel.gif VALIGN=absmiddle>"
oPatterns.Add "IPM.Document.PowerPoint.*", "<IMG SRC=ippoint.gif
VALIGN=absmiddle>"
oPatterns.Add "IPM.Document.*", "<IMG SRC=freedoc.gif VALIGN=absmiddle>"
oPatterns.Add "IPM*", "<IMG SRC=envelope.gif VALIGN='ABSMIDDLE'>"
'Followup Flag
set oFormat = oRenderer.Formats.Add(ActMsgPR_FLAG_STATUS, Null)
set oPatterns = oFormat.Patterns
oPatterns.Add 1, "Completed"
oPatterns.Add 2, "Flagged"
oPatterns.Add "*", "Not Flagged"
'from
Set oFormat = oRenderer.Formats.Add(ActMsgPR_SENT_REPRESENTING_NAME, Null)
oFormat.Patterns.Add "*", "%value%"
strViewName = Request.QueryString("View")
if strViewName <> "" then
on error resume next
err.clear
set oView = oRenderer.Views(strViewName)
ViewIndex = oView.Index
if err.number <> 0 then
'Bogus view
set oView = oRenderer.Views("By Position")
ViewIndex = oView.Index
end if
else
'Set the initial view just in case one wasn't set
set oView = oRenderer.Views("By Position")
ViewIndex = oView.Index
end if
oRenderer.CurrentView = oView
'Check the user's permissions on the folder
nAccess = oCurrentFolder.Fields.Item(ActMsgPR_ACCESS)
bPost = nAccess And MAPI_ACCESS_CREATE_CONTENTS 'Post
'Calculate total number of pages
intMessageCount = oMessages.Count
numrows = oRenderer.RowsPerPage
intPages = (intMessageCount - 1) \ numrows
intPages = intPages + 1
intCurPage = CInt(Request.QueryString("curpage"))
if intCurPage > intPages then
intCurPage = intPages
elseif intCurPage < 1 then
'Initialize it
intCurPage = 1
elseif intMessageCount < 1 then
intCurPage = 1
end if
'Figure out the item count for the current page
intTopCount = intCurPage * oRenderer.RowsPerPage
if intTopCount > oMessages.Count then
intTopCount = oMessages.Count
end if
if oMessages.Count = 0 then
intBottomCount = 0
else
intBottomCount = ((intCurPage-1) * oRenderer.RowsPerPage) + 1
end if
oRenderer.Render 1,intCurPage,0,Response
%>
Figure 16 Workflow Tracking
<%
'Added Code
'Try to create a Vote Table Object
set oVtable = Server.CreateObject("exrt.VoteTable")
'Set the current message to be the process message for the object
oVtable.PIMessage = objOneMsg
'Check to see if any status is there
if oVtable.Count > 0 then
'Create a table for any status values
'If there are no values, don't create table
%>
<TABLE width=90%><TR><TD width=30%><B>Recipient Name</B></TD>
<TD width=20%><B>Current Status</B></TD><TD width=40%><B>Date</B></TD>
</TR>
<%
'Loop through status
for i = 1 to oVtable.Count
Response.write "<TR><TD>"
Set oRTRecipient = oVtable.item(i)
Response.write oRTRecipient.Recipient
Response.write "</TD><TD>"
If oRTRecipient.Status = "" Then
Response.write "Unknown"
Else
Response.Write oRTRecipient.Status
End If
Response.write "</TD><TD>"
If oRTRecipient.Date = "" Then
Response.Write "Unknown"
Else
'The object writes out the time in GMT
Response.write oRTRecipient.Date
End If
Response.write "</TD></TR>"
Next
else
%>
There is currently no workflow status.
<%
end if
%>