How to get your Lotus Notes calendar on your web profile?

    importPackage(java.lang);
    importPackage(java.util);

    var commonUserName = new String(@Name(“[CN]“,@UserName()));
    var mailServer = new StringBuffer();
    var mailFile = new StringBuffer();
    var mailDomain = new StringBuffer();
    var mailSystem = new StringBuffer();
    var profile = new Vector();

    var Reg:NotesRegistration = session.createRegistration();
    Reg.setRegistrationServer(@Subset(@DbName(),”1″));
    Reg.getUserInfo(commonUserName, mailServer, mailFile, mailDomain, mailSystem, profile);
    var MailFilePath = @ReplaceSubstring(mailFile,”\\”,”/”);

    var mailPath = MailFilePath + “.nsf”
    try {
    // gettting the MailServer Path from Config Documents
    var serverName = @DbLookup(@DbName(),”vwConfig”,”MailServer”,2)

    var mailDb:NotesDatabase = session.getDatabase(@Text(serverName),mailPath)

    var inboxView:NotesView = mailDb.getView(“MeetingsOnMyCalendar”) //this will all entries from the calendar

    var today:NotesDateTime = session.createDateTime(@Today())
    var dateRange = session.createDateRange()
    dateRange.setText(@Text(today.getDateOnly()) +” 12:00:00 AM – ” + @Text(today.getDateOnly())+” 11:59:59 PM”)
    var documentCollection:NotesViewEntryCollection = inboxView.getAllEntriesByKey(dateRange);

    var documentCollection1:NotesDocumentCollection = inboxView.getAllDocumentsByKey(dateRange);
    var totalDocumentCount1:Integer =  documentCollection1.getCount();

    var totalDocumentCount:Integer =  documentCollection.getCount();
    var today:NotesDateTime = session.createDateTime(@Today())

    var MeetingDetails=”";

    if(totalDocumentCount==0)
    {
    return “No Meetings for the day”
    }

    var viewEntry:NotesViewEntry = documentCollection.getFirstEntry()
    var newArr = new Array()
    for(x=0;x<totalDocumentCount;x++)
    {

    var document:NotesDocument = viewEntry.getDocument()

    var MeetingDate:NotesDateTime = session.createDateTime(@Text(document.getItemValue(“StartDateTime”)[0]))
    if(MeetingDate.getDateOnly()==today.getDateOnly()){ //This will get you the non-repeated entry – If need all entries need to try here
    var temp = @Text(document.getItemValue(“StartTime”)) + ” – ” +@Text(document.getItemValue(“EndTime”))+”      “+@Text(document.getItemValue(“Subject”))+”#”
    if(MeetingDetails == “”)
    {

    MeetingDetails = temp
    }
    else
    {

    MeetingDetails = MeetingDetails + temp

    }

    }

    viewEntry = documentCollection.getNextEntry(viewEntry)
    }
    if(MeetingDetails==”")
    {
    MeetingDetails =  “No Meeting for the day”
    }

    return MeetingDetails

    }catch(e){
    //Handle the error page
    }





I have been working on the Intranet system of Maarga for the past few days and the challenge was to show an employee’s calendar events in Lotus notes in his intranet profile page. This scenario you may come across in your companies or in your client’s environment especially when you develop portals for the internal employees. It’s s SJSS tweak that can get you this operation done.

XPages
Linoy K George
March 6, 2012 10:17 AM
Rating
233

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...