예제 #1
0
 /**
  * Returns all available data of a single message
  *
  * @param string            $folderid
  * @param string            $id
  * @param ContentParameters $contentparameters flag
  *
  * @access public
  * @return object(SyncObject)
  * @throws StatusException
  */
 public function Fetch($folderid, $id, $contentparameters)
 {
     // get the entry id of the message
     $entryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($folderid), hex2bin($id));
     if (!$entryid) {
         throw new StatusException(sprintf("BackendZarafa->Fetch('%s','%s'): Error getting entryid: 0x%X", $folderid, $id, mapi_last_hresult()), SYNC_STATUS_OBJECTNOTFOUND);
     }
     // open the message
     $message = mapi_msgstore_openentry($this->store, $entryid);
     if (!$message) {
         throw new StatusException(sprintf("BackendZarafa->Fetch('%s','%s'): Error, unable to open message: 0x%X", $folderid, $id, mapi_last_hresult()), SYNC_STATUS_OBJECTNOTFOUND);
     }
     // convert the mapi message into a SyncObject and return it
     $mapiprovider = new MAPIProvider($this->session, $this->store);
     // override truncation
     $contentparameters->SetTruncation(SYNC_TRUNCATION_ALL);
     // TODO check for body preferences
     return $mapiprovider->GetMessage($message, $contentparameters);
 }