getNoticeByUNID (NotesCalendar - JavaScript)

Gets a calendar notice given its universal identifier (UNID).

Defined in

NotesCalendar

Syntax

getNoticeByUNID(unid:string) : NotesCalendarNotice
Parameter Description
unid The universal identifier (UNID) of the Domino® document containing the notice.
Return value Description
NotesCalendarEntry The calendar notice. An exception occurs if the identifier is invalid.

Examples

This button event gets a notice whose UNID is posted to a scoped variable.
var dbdir:NotesDbDirectory = session.getDbDirectory("");
var maildb:NotesDatabase = dbdir.openMailDatabase();
var cal:NotesCalendar = session.getCalendar(maildb);
var unid:string = sessionScope.noticeunid;
var caln:NotesCalendarNotice = cal.getNoticeByUNID(unid);
requestScope.status = "Calendar notice for UNID " + unid + "\n";
requestScope.status = requestScope.status + caln.read();

LotusScript® syntax and examples

NotesCalendar.GetNoticeByUNID(Byval unid As String) As NotesCalendarNotice
This agent gets a notice whose UNID is posted as an environment variable.
Sub Initialize
	Dim session As New NotesSession
	Dim maildb As New NotesDatabase("", "")
	Dim unid As String
	Dim cal As NotesCalendar
	Dim db As NotesDatabase
	Dim doc As NotesDocument
	Dim body As NotesRichTextItem
	REM Get calendar for current user
	Call maildb.Openmail()
	Set cal = session.getCalendar(maildb)
	Set db = session.CurrentDatabase
	REM Create document to post results
	Set doc = db.CreateDocument
	doc.Form = "main"
	doc.Subject = "Calendar notice"
	Set body = doc.Createrichtextitem("body")
	REM Get notice and put in body of document
	unid = session.Getenvironmentstring("noticeunid")
	body.Appendtext("Calendar entry for UNID " & unid)
	body.Addnewline(1)
	body.Appendtext(cal.Getnoticebyunid(unid).read())
	Call doc.Save( True, True )
End Sub

Java syntax and examples

NotesCalendarNotice NotesCalendar.getNoticeByUNID(String unid)
This agent gets a notice whose UNID is posted as an environment variable.
import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();

          // (Your code goes here)
          DbDirectory dbdir = session.getDbDirectory("");
          Database maildb = dbdir.openMailDatabase();
          // Create document to post results
          Database db = agentContext.getCurrentDatabase();
          Document doc = db.createDocument();
          doc.appendItemValue("Form", "main");
          doc.appendItemValue("subject", "Calendar notice");
          RichTextItem body = doc.createRichTextItem("body");
          // Get notice and put in body of document
          String unid = session.getEnvironmentString("noticeunid");
          NotesCalendar cal = session.getCalendar(maildb);
          body.appendText("Calendar notice for UNID " + unid + "\n");
          body.appendText(cal.getNoticeByUNID(unid).read());
          doc.save(true, true);

      } catch(Exception e) {
          e.printStackTrace();
       }
   }
}