UID (NotesCalendarEntry - JavaScript)

Read-only. Globally unique identifier of a calendar entry in iCalendar format.

Defined in

NotesCalendarEntry

Syntax

getUID() : string

Usage

The UID is generated upon creation of the entry and takes the following form:
UID:F0A3694E4E7E20938525790F004D370A-Lotus_Notes_Generated

Examples

This button event gets a calendar entry using the UNID for a document from the ($Calendar) view in the mail database of the current user, and posts its UID to a sessionScope variable.
// requestScope.calentry is bound to an edit box whose data is decimal, integer only
var n = Math.floor(requestScope.calentry);
var dbdir:NotesDbDirectory = session.getDbDirectory("");
var maildb:NotesDatabase = dbdir.openMailDatabase();
var calview:NotesView = maildb.getView("($Calendar)");
var caldoc:NotesDocument = calview.getNthDocument(n);
if (caldoc == null) {
	requestScope.status = "Calendar entry out of range";
	return;
}
var unid:string = caldoc.getUniversalID();
var cal:NotesCalendar = session.getCalendar(maildb);
var cale:NotesCalendarEntry = cal.getEntryByUNID(unid);
sessionScope.currentuid = cale.getUID();
requestScope.status = "Current entry is UID " + sessionScope.currentuid;

LotusScript® syntax and examples

NotesCalendarEntry.UID As String
This agent gets a calendar entry using the UNID for a document from the ($Calendar) view in the mail database of the current user, and posts its UID to an environment variable.
Sub Initialize
	Dim session As New NotesSession
	Dim maildb As New NotesDatabase("", "")
	Dim calview As NotesView
	Dim caldoc As NotesDocument
	Dim unid As String
	Dim cal As NotesCalendar
	Dim cale As NotesCalendarEntry
	Dim s As String
	Dim n As Long
	REM Get calendar for current user
	Call maildb.Openmail()
	Set cal = session.getCalendar(maildb)
	REM Get number of calendar entry
	s = InputBox("Enter an integer", "calentry", 1)
	If IsNumeric(s) Then
		n = Clng(s)
	Else
		MessageBox "Not numeric: " & s,, "Error"
		Exit sub
	End If
	REM Get calendar entry and post UID to environment variable
	Set calview = maildb.Getview("($Calendar)")
	Set caldoc = calview.Getnthdocument(n)
	If caldoc Is Nothing Then
		MessageBox "Calendar entry out of range",, "Error"
		Exit sub
	Else
		unid = caldoc.Universalid
		Set cale = cal.Getentrybyunid(unid)
		Call session.Setenvironmentvar("currentuid", cale.Uid)
	End If
End Sub

Java syntax and examples

String NotesCalendarEntry.getUID()
This agent gets a calendar entry using the UNID for a document from the ($Calendar) view in the mail database of the current user, and posts its UID to 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)
          Integer n = (Integer)session.getEnvironmentValue("calentry");
          DbDirectory dbdir = session.getDbDirectory("");
          Database maildb = dbdir.openMailDatabase();
          View calview = maildb.getView("($Calendar)");
          Document caldoc = calview.getNthDocument(n.intValue());
          if (caldoc == null) return;
          String unid = caldoc.getUniversalID();
          NotesCalendar cal = session.getCalendar(maildb);
          NotesCalendarEntry cale = cal.getEntryByUNID(unid);
          session.setEnvironmentVar("currentuid", cale.getUID());

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