Q
Problem solve Get help with specific problems with your technologies, process and projects.

Displaying inbox/calendar on homepage in embedded view

How can I display the user's inbox and calendar on the homepage in an embedded view once the person logs into the homepage and is redirected through mailjump.nsf?
Personally, I would look into using either an agent or a servlet to do what you want here. A servlet would be for an environment with lots of users. The views that you find in a standard Lotus Notes (or Domino Web Access) mail database are not suited to be embedded in a Web page in a portal.

Below I have a sample agent that (assuming that the user is authenticated and exists in the Domino Directory with a reference to his mail database) will display what is inside his inbox.

Create a new LotusScript agent in a database, call it getinbox and paste the code. Then try calling it using

/database.nsf/getinbox?OpenAgent. 

It should display something like this (this screen dump comes from a Danish mail database):

Figure 1

Sample code:

'getinbox: 

Option Public
Option Declare

Sub Initialize
 Dim ses As New NotesSession
 Dim namesDb As NotesDatabase
 Dim webDoc As NotesDocument
 Dim userName As String
 Dim userDoc As NotesDocument
 Dim userMailBox As notesdatabase
 Dim mailView As NotesView
 Dim mailDoc As NotesDocument
 Dim usermailfile As String
 
 Set namesdb = ses.GetDatabase
("","names.nsf")
 Set webdoc = ses.DocumentContext
 userName = webdoc.remote_user(0)
 
 Set userdoc = namesdb.GetView
("($Users)").GetDocumentByKey(userName)
 Set userMailBox = ses.GetDatabase
("",userdoc.mailfile(0)+".nsf")
 Set mailView = userMailBox.GetView
("($Inbox)")
 Set mailDoc = mailView.GetFirstDocument
 userMailFile = Replace(userdoc.
mailfile(0),"","/")+".nsf"
 Print "<html>"
 Print "<head>"
 Print "<style>"
 Print ".top"
 Print "{"
 Print "font-weight:bold;"
 Print "}"
 Print "</style>"
 
 Print "</head>"
 
 Print "<body topmargin='0' 
leftmargin='0'>"
 
 Print "<table style='font-size:10;
font-family:verdana' border='0' 
cellpadding='1' cellspacing='0'>"
 Print "<tr>"
 Print "<td valign='top' width='12'>
 </td>"
 Print "<td valign='top' width='100'><span 
class='top'>Who</span></td>"
 Print "<td valign='top' width='73'><span 
class='top'>Date</span></td>"
 Print "<td valign='top' width='40'><span 
class='top'>Time</span></td>"
 Print "<td valign='top'><span 
class='top'>subject</span></td>"
 Print "</tr>"
 
 Print "<tr>"
 Print "<td style='padding:0' colspan='5
'><hr></td>"
 Print "<tr>"
 While Not mailDoc Is Nothing 
  Dim fromName As New notesname
(mailDoc.from(0))
  Dim fromDate As New NotesDateTime
(mailDoc.DeliveredDate(0))
  Print |<tr onclick="window.open('/|+usermailfile+|/
($indbox)/|+maildoc.UniversalID+|/?opendocument')" 
onmouseover="this.style.cursor='default'; 
this.style.backgroundColor='#DEDBBD'" 
onmouseout="this.style.backgroundColor=
'#FFFFFF'">|
  
  Dim ViewIcon As String
  ViewIcon = Cstr(maildoc.GetItemValue
("_viewicon")(0))
  If Len(ViewIcon) > 0 Then
   If Len(ViewIcon) = 2 Then
    ViewIcon = "0"+ViewIcon
   Else
    If Len(ViewIcon) = 1 Then
     ViewIcon = "00"+ViewIcon
    End If 
   End If
   
   Print "<td valign='top'><img 
src='/icons/vwicn"+ViewIcon+".gif'></td>" 
  Else
   Print "<td valign='top'> </td>" 
  End If
  
  Print "<td valign='top'>"+fromname.
Common+"</td>"
  Print "<td valign='top'>"+fromDate.
DateOnly+"</td>"
  Print "<td 
valign='top'>"+Format$(fromDate.
TimeOnly,"HH:mm")+"</td>"
  Print "<td valign='top'>"+
mailDoc.subject(0)
+"</td>"
  Print "</tr>"
  Set mailDoc = mailView.
GetNextDocument(mailDoc)
 Wend
 Print "</table>"
 Print "</body>"
End Sub

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close