freeTimeSearch (NotesSession - JavaScript)

Searches for free-time slots in the calendar.

Defined in

NotesSession

Syntax

freeTimeSearch(window:NotesDateRange, duration:int, names:any, firstfit:boolean) : java.util.Vector
Parameter Description
window Starting and ending times within which to search for a match. Cannot be null.
duration The length in minutes of the free-time interval you want to schedule.
names String or vector of strings. The name or names of the people or groups whose free time you want to schedule. Cannot be null.
firstfit Specify true if you just want the first matching date range, false if you want all matching times.
Return value Description
java.util.Vector Each member of the vector is a NotesDateRange object. The vector is null if there are no matches.

Examples

This button finds the first free time slot for two persons until the end of the next day.
// Set up the time range
var start:NotesDateTime = session.createDateTime("Today");
var end:NotesDateTime = session.createDateTime("Today");
start.setNow();
end.setNow();
end.adjustDay(1);
var window:NotesDateRange = session.createDateRange();
window.setStartDateTime(start);
window.setEndDateTime(end);
// Set up the names
var names = new java.util.Vector();
names.addElement("Roberta Person");
names.addElement("Neal Strong");
// Find the free time
var freetime:java.util.Vector = session.freeTimeSearch(window, 60, names, true);
if (freetime == null) {
	requestScope.free = "No time slots";
} else {
	requestScope.free = "First available time slot\n";
	var dr:NotesDateRange = freetime.firstElement();
	var sdt:NotesDateTime = dr.getStartDateTime();
	var edt:NotesDateTime = dr.getEndDateTime();
	requestScope.free = requestScope.free + sdt.getLocalTime() + " start\n";
	requestScope.free = requestScope.free + edt.getLocalTime() + " end";
}