getEntryByUNID (NotesCalendar - JavaScript)

ユニバーサル ID (UNID) が指定された場合に、カレンダーエントリを取得します。

定義場所

NotesCalendar

構文

getEntryByUNID(unid:string) : NotesCalendarEntry
パラメータ 説明
unid エントリを含む Domino 文書のユニバーサル ID (UNID)。
戻り値 説明
NotesCalendarEntry カレンダーエントリ。識別子が正しくない場合は、例外が発生します。

このボタンイベントは、 現在のユーザーのメールデータベースの ($Calendar) ビューから、 文書の UNID を使用してカレンダーエントリを取得します。
// 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);
requestScope.status = "Calendar entry for UNID " + unid + "¥n";
requestScope.status = requestScope.status + cal.getEntryByUNID(unid).read();

LotusScript® 構文と例

NotesCalendar.GetEntryByUNID(Byval unid As String) As NotesCalendarEntry
このエージェントは、 現在のユーザーのメールデータベースの ($Calendar) ビューから、 文書の UNID を使用してカレンダーエントリを取得します。
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 db As NotesDatabase
	Dim doc As NotesDocument
	Dim body As NotesRichTextItem
	Dim s As String
	Dim n As long
	REM Get calendar for current user
	Call maildb.Openmail()
	Set cal = session.getCalendar(maildb)
	Set db = session.CurrentDatabase
	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"
	End If
	REM Create document to post results
	Set doc = db.CreateDocument
	doc.Form = "main"
	doc.Subject = "Calendar entry"
	Set body = doc.Createrichtextitem("body")
	REM Get entry and put in body of document
	Set calview = maildb.Getview("($Calendar)")
	Set caldoc = calview.Getnthdocument(n)
	If caldoc Is Nothing Then
		body.Appendtext("Calendar entry out of range")
	Else
		unid = caldoc.Universalid
		body.Appendtext("Calendar entry for UNID " & unid)
		body.Addnewline(1)
		body.Appendtext(cal.Getentrybyunid(unid).Read())
	End If
	Call doc.Save( True, True )
End Sub

Java™ 構文と例

NotesCalendarEntry NotesCalendar.getEntryByUNID(String unid)
このエージェントは、 現在のユーザーのメールデータベースの ($Calendar) ビューから、 文書の UNID を使用してカレンダーエントリを取得します。
import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

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

          // (Your code goes here)
          // calentry environment variable must be previously set
          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());
          // Create document to post results
          Database db = agentContext.getCurrentDatabase();
          Document doc = db.createDocument();
          doc.appendItemValue("Form", "main");
          doc.appendItemValue("subject", "Calendar entry");
          RichTextItem body = doc.createRichTextItem("body");
          // Get entry and put in body of document
          if (caldoc != null) {
              String unid = caldoc.getUniversalID();
              NotesCalendar cal = session.getCalendar(maildb);
              body.appendText("Calendar entry for UNID " + unid + "¥n");
              body.appendText(cal.getEntryByUNID(unid).read());
          } else {
        	  body.appendText("Calendar entry out of range");
          }
          doc.save(true, true);

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