Name

Freebusy Functions — This section describes freebusy specific functions to see the freebusy data of the users.

Synopsis

resource IFreeBusySupport mapi_freebusysupport_open(resource $session,
                                                    resource $messagestore);

boolean mapi_freebusysupport_close(resource $freebusysupport);
array freebusydata mapi_freebusysupport_loaddata(resource $freebusysupport,
                                                 array $fbusers);

array freebusydata mapi_freebusysupport_loadupdate(resource $freebusysupport,
                                                   array $fbusers);

resource freebusyenumblock mapi_freebusydata_enumblocks(resource $freebusydata,
                                                        long $starttime,
                                                        long $endtime);

array mapi_freebusydata_getpublishrange(resource $freebusydata);
boolean mapi_freebusydata_setrange(resource $freebusydata,
                                   long $starttime,
                                   long $endtime);

boolean mapi_freebusyenumblock_reset(resource $freebusyenumblock);
boolean mapi_freebusyenumblock_skip(resource $freebusyenumblock);
boolean mapi_freebusyenumblock_restrict(resource $freebusyenumblock,
                                        long $starttime,
                                        long $endtime);

boolean mapi_freebusyenumblock_next(resource $freebusyenumblock,
                                    long $celt,
                                    long $endtime);

boolean mapi_freebusyupdate_reset(resource $freebusyupdate);
boolean mapi_freebusyupdate_publish(resource $freebusyupdate,
                                    array $freebusyblocks);

boolean mapi_freebusyupdate_savechanges(resource $freebusyupdate,
                                        long $starttime,
                                        long $endtime);

Details

mapi_freebusysupport_open ()

resource mapi_freebusysupport_open(resource $session, resource $messagestore)

Retreive freebusy support object

$session
The resource id of a session of the user.
$messagestore (optional)
The resource id of the messagestore of the user. Only when you update the freebusy data.

Example 3.69. Open a freebusysupport object

$fbsupport = mapi_freebusysupport_open($session);
		

resource $fbsupport, freebusysupport


mapi_freebusysupport_close ()

boolean mapi_freebusysupport_close(resource $freebusysupport)

Close the freebusy support object

$freebusysupport
The resource id of a freebusysupport object.

Example 3.70. Close a freebusysupport object

$fbsupport = mapi_freebusysupport_open($session);
// Do something
$result = mapi_freebusysupport_close($fbsupport);
		

true is succeeded


mapi_freebusysupport_loaddata ()

array mapi_freebusysupport_loaddata(resource $freebusysupport, array $fbusers)

Get a freebusydata object for one of more users.

$freebusysupport
The resource id of a freebusysupport object.
$fbusers
An array of user addressbook entryids

Example 3.71. Get freebusydata object of one user

$fbsupport = mapi_freebusysupport_open($session);

$fbDataArray = mapi_freebusysupport_loaddata($fbsupport, array($userentrid1, $userentrid2) );

if(isset($fbDataArray[0]))
{
  $rangeuser1 = mapi_freebusydata_getpublishrange($fbDataArray[0]);
  print_r($rangeuser1);
}else {
  echo "No freebusy for User 1\n";
}

if(isset($fbDataArray[1]))
{
  $rangeuser2 = mapi_freebusydata_getpublishrange($fbDataArray[1]);
  print_r($rangeuser2);
}else {
  echo "No freebusy for User 2\n";
}

mapi_freebusysupport_close($fbsupport);
		

Array( [start] => 1157061600 [end] => 1162335600 ) No freebusy for User 2


mapi_freebusysupport_loadupdate ()

Get freebusy write objects for one of more users.

array freebusydata mapi_freebusysupport_loadupdate(resource $freebusysupport,
                                                   array $fbusers);
$freebusysupport
The resource id of a freebusysupport object.
$fbusers
An array of user addressbook entryids

Example 3.72. Get freebusyupdate object of one user

$fbupdate = mapi_freebusysupport_loadupdate($fbsupport, array($userentryid));

$result = mapi_freebusyupdate_reset($fbupdate[0]);

$fbblocks = array( 
  array("start" => 1157439600, "end" => 1157468400, "status" => 2),
  array("start" => 1157526000, "end" => 1157554800, "status" => 2)
);
// Add fbblocks
$result = mapi_freebusyupdate_publish($fbupdate[0], $fbblocks);
		  
// Save data
$result = mapi_freebusyupdate_savechanges($fbupdate[0], 1157061600, 1162335600);
		

Description

Get freebusyupdate object of one or more users to write the new freebusydata.

See Also

mapi_freebusysupport_open mapi_freebusysupport_close

mapi_freebusydata_enumblocks ()

resource mapi_freebusydata_enumblocks(resource $freebusydata, long $starttime, long $endtime)

Get an interface to supports accessing and enumerating free/busy blocks of data for a user within a time range.

$freebusydata
The resource id of a freebusydata object.
$starttime
starttime of the freebusy information in unixtimestamp
$endtime
endtime of the freebusy information in unixtimestamp

Example 3.73. Get freebusy enumblock object of one user and read some data

$enumblock = mapi_freebusydata_enumblocks($fbData, 0, 0xFFFFFFFF);

// Set the cursur on the begining
$result = mapi_freebusyenumblock_reset($enumblock);
		  
//Read the free/busy blocks in a cycles of 2 blocks
while(true)
{
  $blocks = mapi_freebusyenumblock_next($enumblock, 2);
  if($blocks == false)
    break;
  print_r($blocks);
}
		

Array ( [0] => Array ( [start] => 1157439600 [end] => 1157468400 [status] => 2 ) [1] => Array ( [start] => 1157526000 [end] => 1157554800 [status] => 2 ) )


mapi_freebusydata_getpublishrange ()

Gets a preset time range for an enumeration of free/busy blocks of data for a user

Get free/busy publish range, start and end time in unixtimestamp format

array mapi_freebusydata_getpublishrange(resource $freebusydata);
$freebusydata
The resource id of a freebusydata object.

Example 3.74. Get freebusy publish range

		  See mapi_freebusysupport_loaddata
		

mapi_freebusydata_setrange ()

boolean mapi_freebusydata_setrange(resource $freebusydata, long $starttime, long $endtime)

Sets the range of time for an enumeration of free/busy block of data for a user.

Sets the freebusy range of time

$freebusydata
The resource id of a freebusydata object.
$starttime
starttime of the freebusy information in unixtimestamp
$endtime
endtime of the freebusy information in unixtimestamp

Example 3.75. Sets the freebusy range of time.

$result = mapi_freebusydata_setrange($freebusydata, 1157061600, 1162335600);
		

return $result, false or true


mapi_freebusyenumblock_reset ()

boolean mapi_freebusyenumblock_reset(resource $freebusyenumblock)

Resets the enumerator by setting the cursor to the beginning.

$freebusyenumblock
The resource id of a free/busy enumblock object.

Example 3.76. Sets the cursor to the beginning

		  See mapi_freebusydata_enumblocks
		

mapi_freebusyenumblock_skip ()

boolean mapi_freebusyenumblock_skip(resource $freebusyenumblock)

Skips a specified number of blocks of free/busy data.

$freebusyenumblock
The resource id of a free/busy enumblock object.

Example 3.77. Skips 2 blocks of free/busy data.

$enumblock = mapi_freebusydata_enumblocks($fbData, 0, 0xFFFFFFFF);

// Set the cursur on the begining
$result = mapi_freebusyenumblock_reset($enumblock);

// Skip 2 free/busy blocks
$result = mapi_freebusyenumblock_skip($enumblock, 2);

// Read the 2 free/busy blocks
$blocks = mapi_freebusyenumblock_next($enumblock, 2);
		

mapi_freebusyenumblock_restrict ()

boolean mapi_freebusyenumblock_restrict(resource $freebusyenumblock, long $starttime, long $endtime)

Restricts the enumeration to a specified time period.

$freebusyenumblock
The resource id of a free/busy enumblock object.
$starttime
starttime of the free/busy information in unixtimestamp
$endtime
endtime of the free/busy information in unixtimestamp

Example 3.78. Restricts the enumeration to a specified time period.

$enumblock = mapi_freebusydata_enumblocks($fbData, 0, 0xFFFFFFFF);

// Set the cursur on the begining
$result = mapi_freebusyenumblock_reset($enumblock);

//Restrict the free/busy data
$result = mapi_freebusyenumblock_restrict($enumblock, 0x12345578, 0xFFFF0000);

//Read the 2 free/busy blocks
$blocks = mapi_freebusyenumblock_next($enumblock, 2);
		

-


mapi_freebusyenumblock_next ()

boolean mapi_freebusyenumblock_next(resource $freebusyenumblock, long $celt, long $endtime)

Gets the next specified number of blocks of free/busy data in an enumeration.

$freebusyenumblock
The resource id of a free/busy enumblock object.
$celt
items to retreive

Example 3.79. Gets the next 10 blocks of free/busy data.

		  See mapi_freebusydata_enumblocks
		

mapi_freebusyupdate_reset ()

boolean mapi_freebusyupdate_reset(resource $freebusyupdate)

Remove all current free/busy data

$freebusysupport
The resource id of a freebusyupdate object.

Example 3.80. Remove all current free/busy data

		  See mapi_freebusysupport_loadupdate
		

mapi_freebusyupdate_publish ()

boolean mapi_freebusyupdate_publish(resource $freebusyupdate, array $freebusyblocks)

Publish a specified number of blocks of free/busy data. May be called more than once successively.

$freebusysupport
The resource id of a freebusyupdate object.
$freebusyblocks
An array of free/busy data blocks.

Example 3.81. Publish 2 blocks of free/busy data

		  See mapi_freebusysupport_loadupdate
		

mapi_freebusyupdate_savechanges ()

boolean mapi_freebusyupdate_savechanges(resource $freebusyupdate, long $starttime, long $endtime)

Save the free/busy data with time frame between the begintime and endtime.

$freebusysupport
The resource id of a freebusyupdate object.
$starttime
starttime of the freebusy information in unixtimestamp
$endtime
endtime of the freebusy information in unixtimestamp

Example 3.82. Save the free/busy data

		  See mapi_freebusysupport_loadupdate