当前位置: 首页>>代码示例>>PHP>>正文


PHP mapi_msgstore_openentry函数代码示例

本文整理汇总了PHP中mapi_msgstore_openentry函数的典型用法代码示例。如果您正苦于以下问题:PHP mapi_msgstore_openentry函数的具体用法?PHP mapi_msgstore_openentry怎么用?PHP mapi_msgstore_openentry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mapi_msgstore_openentry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foldersize

function foldersize($store, $entryid)
{
    $size = 0;
    $folder = mapi_msgstore_openentry($store, $entryid);
    if (!$folder) {
        print "Unable to open folder.";
        return false;
    }
    $table = mapi_folder_getcontentstable($folder);
    if (!$table) {
        print "Unable to open table.";
        return false;
    }
    while (1) {
        $rows = mapi_table_queryrows($table, array(PR_MESSAGE_SIZE), 0, 100);
        if (count($rows) == 0) {
            break;
        }
        foreach ($rows as $row) {
            if (isset($row[PR_MESSAGE_SIZE])) {
                $size += $row[PR_MESSAGE_SIZE];
            }
        }
    }
    return $size;
}
开发者ID:marco-uniware,项目名称:zarafa-tools,代码行数:26,代码来源:foldersize.php

示例2: getFullRecurrenceBlob

 function getFullRecurrenceBlob()
 {
     $message = mapi_msgstore_openentry($this->store, $this->messageprops[PR_ENTRYID]);
     $recurrBlob = '';
     $stream = mapi_openproperty($message, $this->proptags["recurring_data"], IID_IStream, 0, 0);
     $stat = mapi_stream_stat($stream);
     for ($i = 0; $i < $stat['cb']; $i += 1024) {
         $recurrBlob .= mapi_stream_read($stream, 1024);
     }
     if (!empty($recurrBlob)) {
         $this->messageprops[$this->proptags["recurring_data"]] = $recurrBlob;
     }
 }
开发者ID:tuksik,项目名称:zarafa-rest-api,代码行数:13,代码来源:class.baserecurrence.php

示例3: renamefolder

function renamefolder($store, $entryid, $name)
{
    if (!$entryid) {
        print "Unable to find {$name} folder\n";
        return;
    }
    $folder = mapi_msgstore_openentry($store, $entryid);
    if (!$folder) {
        print "Unable to open folder " . bin2hex($entryid) . "\n";
        return;
    }
    mapi_setprops($folder, array(PR_DISPLAY_NAME => $name));
    if (mapi_last_hresult() != 0) {
        print "Unable to rename " . bin2hex($entryid) . " to '{$name}'\n";
    } else {
        print "Renamed " . bin2hex($entryid) . " to '{$name}'\n";
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:18,代码来源:exec.zarafa7.foldersnames.php

示例4: SetSecurity

function SetSecurity($store, $entryid, $acls)
{
    if ($entryid == "") {
        $object = $store;
    } else {
        $object = mapi_msgstore_openentry($store, $entryid);
    }
    if (!$object) {
        print "Unable to open folder\n";
        return;
    }
    $ret = mapi_zarafa_setpermissionrules($object, $acls);
    if ($ret == false) {
        print "Unable to set permissions\n";
    } else {
        print "Permissions successfully set\n";
    }
}
开发者ID:marco-uniware,项目名称:zarafa-tools,代码行数:18,代码来源:mailstore-permissions.php

示例5: publishFreeBusy

/**
 * Publishing the FreeBusy information of the default calendar. The 
 * folderentryid argument is used to check if the default calendar 
 * should be updated or not.
 * 
 * @param $store MAPIobject Store object of the store that needs publishing
 * @param $folderentryid binary entryid of the folder that needs to be updated.
 */
function publishFreeBusy($store, $l_rSession, $folderentryid = false)
{
    // Publish updated free/busy information
    // First get default calendar from the root folder
    $rootFolder = mapi_msgstore_openentry($store, null);
    $rootFolderProps = mapi_getprops($rootFolder, array(PR_IPM_APPOINTMENT_ENTRYID));
    // If no folderentryid supplied or if the supplied entryid matches the default calendar.
    if (!$folderentryid || $rootFolderProps[PR_IPM_APPOINTMENT_ENTRYID] == $folderentryid) {
        // Get the calendar and owner entryID
        $calendar = mapi_msgstore_openentry($store, $rootFolderProps[PR_IPM_APPOINTMENT_ENTRYID]);
        $storeProps = mapi_msgstore_getprops($store, array(PR_MAILBOX_OWNER_ENTRYID));
        if (isset($storeProps[PR_MAILBOX_OWNER_ENTRYID])) {
            // Lets share!
            $pub = new FreeBusyPublish($l_rSession, $store, $calendar, $storeProps[PR_MAILBOX_OWNER_ENTRYID]);
            $pub->publishFB(time() - 7 * 24 * 60 * 60, 6 * 30 * 24 * 60 * 60);
            // publish from one week ago, 6 months ahead
        }
    }
}
开发者ID:marco-uniware,项目名称:zarafa-tools,代码行数:27,代码来源:process_meetingrequests.php

示例6: ImportFolderChange

 /**
  * Imports a change on a folder
  *
  * @param object        $folder     SyncFolder
  *
  * @access public
  * @return string       id of the folder
  * @throws StatusException
  */
 public function ImportFolderChange($folder)
 {
     $id = isset($folder->serverid) ? $folder->serverid : false;
     $parent = $folder->parentid;
     $displayname = u2wi($folder->displayname);
     $type = $folder->type;
     if (Utils::IsSystemFolder($type)) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, system folder can not be created/modified", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname), SYNC_FSSTATUS_SYSTEMFOLDER);
     }
     // create a new folder if $id is not set
     if (!$id) {
         // the root folder is "0" - get IPM_SUBTREE
         if ($parent == "0") {
             $parentprops = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID));
             if (isset($parentprops[PR_IPM_SUBTREE_ENTRYID])) {
                 $parentfentryid = $parentprops[PR_IPM_SUBTREE_ENTRYID];
             }
         } else {
             $parentfentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($parent));
         }
         if (!$parentfentryid) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent folder (no entry id)", Utils::PrintAsString(false), $folder->parentid, $displayname), SYNC_FSSTATUS_PARENTNOTFOUND);
         }
         $parentfolder = mapi_msgstore_openentry($this->store, $parentfentryid);
         if (!$parentfolder) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent folder (open entry)", Utils::PrintAsString(false), $folder->parentid, $displayname), SYNC_FSSTATUS_PARENTNOTFOUND);
         }
         //  mapi_folder_createfolder() fails if a folder with this name already exists -> MAPI_E_COLLISION
         $newfolder = mapi_folder_createfolder($parentfolder, $displayname, "");
         if (mapi_last_hresult()) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, mapi_folder_createfolder() failed: 0x%X", Utils::PrintAsString(false), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_FOLDEREXISTS);
         }
         mapi_setprops($newfolder, array(PR_CONTAINER_CLASS => MAPIUtils::GetContainerClassFromFolderType($type)));
         $props = mapi_getprops($newfolder, array(PR_SOURCE_KEY));
         if (isset($props[PR_SOURCE_KEY])) {
             $sourcekey = bin2hex($props[PR_SOURCE_KEY]);
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("Created folder '%s' with id: '%s'", $displayname, $sourcekey));
             return $sourcekey;
         } else {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, folder created but PR_SOURCE_KEY not available: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
         }
         return false;
     }
     // open folder for update
     $entryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($id));
     if (!$entryid) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open folder (no entry id): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
     }
     // check if this is a MAPI default folder
     if ($this->mapiprovider->IsMAPIDefaultFolder($entryid)) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, MAPI default folder can not be created/modified", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname), SYNC_FSSTATUS_SYSTEMFOLDER);
     }
     $mfolder = mapi_msgstore_openentry($this->store, $entryid);
     if (!$mfolder) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open folder (open entry): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
     }
     $props = mapi_getprops($mfolder, array(PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_DISPLAY_NAME, PR_CONTAINER_CLASS));
     if (!isset($props[PR_SOURCE_KEY]) || !isset($props[PR_PARENT_SOURCE_KEY]) || !isset($props[PR_DISPLAY_NAME]) || !isset($props[PR_CONTAINER_CLASS])) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, folder data not available: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
     }
     // get the real parent source key from mapi
     if ($parent == "0") {
         $parentprops = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID));
         $parentfentryid = $parentprops[PR_IPM_SUBTREE_ENTRYID];
         $mapifolder = mapi_msgstore_openentry($this->store, $parentfentryid);
         $rootfolderprops = mapi_getprops($mapifolder, array(PR_SOURCE_KEY));
         $parent = bin2hex($rootfolderprops[PR_SOURCE_KEY]);
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesICS->ImportFolderChange(): resolved AS parent '0' to sourcekey '%s'", $parent));
     }
     // a changed parent id means that the folder should be moved
     if (bin2hex($props[PR_PARENT_SOURCE_KEY]) !== $parent) {
         $sourceparentfentryid = mapi_msgstore_entryidfromsourcekey($this->store, $props[PR_PARENT_SOURCE_KEY]);
         if (!$sourceparentfentryid) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent source folder (no entry id): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
         }
         $sourceparentfolder = mapi_msgstore_openentry($this->store, $sourceparentfentryid);
         if (!$sourceparentfolder) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent source folder (open entry): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
         }
         $destparentfentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($parent));
         if (!$sourceparentfentryid) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open destination folder (no entry id): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
         }
         $destfolder = mapi_msgstore_openentry($this->store, $destparentfentryid);
         if (!$destfolder) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open destination folder (open entry): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
         }
         // mapi_folder_copyfolder() fails if a folder with this name already exists -> MAPI_E_COLLISION
         if (!mapi_folder_copyfolder($sourceparentfolder, $entryid, $destfolder, $displayname, FOLDER_MOVE)) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to move folder: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_FOLDEREXISTS);
         }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:101,代码来源:importer.php

示例7: ImportMessageChange

 /**
  * Imports a single message
  *
  * @param array         $props
  * @param long          $flags
  * @param object        $retmapimessage
  *
  * @access public
  * @return long
  */
 public function ImportMessageChange($props, $flags, &$retmapimessage)
 {
     $sourcekey = $props[PR_SOURCE_KEY];
     $parentsourcekey = $props[PR_PARENT_SOURCE_KEY];
     $entryid = mapi_msgstore_entryidfromsourcekey($this->store, $parentsourcekey, $sourcekey);
     if (!$entryid) {
         return SYNC_E_IGNORE;
     }
     $mapimessage = mapi_msgstore_openentry($this->store, $entryid);
     try {
         $message = $this->mapiprovider->GetMessage($mapimessage, $this->contentparameters);
     } catch (SyncObjectBrokenException $mbe) {
         $brokenSO = $mbe->GetSyncObject();
         if (!$brokenSO) {
             ZLog::Write(LOGLEVEL_ERROR, sprintf("PHPWrapper->ImportMessageChange(): Catched SyncObjectBrokenException but broken SyncObject available"));
         } else {
             if (!isset($brokenSO->id)) {
                 $brokenSO->id = "Unknown ID";
                 ZLog::Write(LOGLEVEL_ERROR, sprintf("PHPWrapper->ImportMessageChange(): Catched SyncObjectBrokenException but no ID of object set"));
             }
             ZPush::GetDeviceManager()->AnnounceIgnoredMessage(false, $brokenSO->id, $brokenSO);
         }
         // tell MAPI to ignore the message
         return SYNC_E_IGNORE;
     }
     // substitute the MAPI SYNC_NEW_MESSAGE flag by a z-push proprietary flag
     if ($flags == SYNC_NEW_MESSAGE) {
         $message->flags = SYNC_NEWMESSAGE;
     } else {
         $message->flags = $flags;
     }
     $this->importer->ImportMessageChange(bin2hex($sourcekey), $message);
     // Tell MAPI it doesn't need to do anything itself, as we've done all the work already.
     return SYNC_E_IGNORE;
 }
开发者ID:inkoss,项目名称:karoshi-server,代码行数:45,代码来源:mapiphpwrapper.php

示例8: ExportChangesICS

 /**
  * Constructor
  *
  * @param mapisession       $session
  * @param mapistore         $store
  * @param string             (opt)
  *
  * @access public
  * @throws StatusException
  */
 public function ExportChangesICS($session, $store, $folderid = false)
 {
     // Open a hierarchy or a contents exporter depending on whether a folderid was specified
     $this->session = $session;
     $this->folderid = $folderid;
     $this->store = $store;
     $this->restriction = false;
     try {
         if ($folderid) {
             $entryid = mapi_msgstore_entryidfromsourcekey($store, $folderid);
         } else {
             $storeprops = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID));
             $entryid = $storeprops[PR_IPM_SUBTREE_ENTRYID];
         }
         $folder = false;
         if ($entryid) {
             $folder = mapi_msgstore_openentry($this->store, $entryid);
         }
         // Get the actual ICS exporter
         if ($folderid) {
             if ($folder) {
                 $this->exporter = mapi_openproperty($folder, PR_CONTENTS_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0);
             } else {
                 $this->exporter = false;
             }
         } else {
             $this->exporter = mapi_openproperty($folder, PR_HIERARCHY_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0);
         }
     } catch (MAPIException $me) {
         $this->exporter = false;
         // We return the general error SYNC_FSSTATUS_CODEUNKNOWN (12) which is also SYNC_STATUS_FOLDERHIERARCHYCHANGED (12)
         // if this happened while doing content sync, the mobile will try to resync the folderhierarchy
         throw new StatusException(sprintf("ExportChangesICS('%s','%s','%s'): Error, unable to open folder: 0x%X", $session, $store, Utils::PrintAsString($folderid), mapi_last_hresult()), SYNC_FSSTATUS_CODEUNKNOWN);
     }
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:45,代码来源:exporter.php

示例9: UpdateFB

 function UpdateFB($addressbook, $session, $rootstore, $entryid)
 {
     $abentry = mapi_ab_openentry($addressbook, $entryid);
     if (!$abentry) {
         print "Unable to open entry in addressbook\n";
         return false;
     }
     $abprops = mapi_getprops($abentry, array(PR_ACCOUNT));
     $storeid = mapi_msgstore_createentryid($rootstore, $abprops[PR_ACCOUNT]);
     if (!$storeid) {
         print "Unable to get store entryid\n";
         return false;
     }
     $store = mapi_openmsgstore($session, $storeid);
     if (!$store) {
         print "Unable to open store\n";
         return false;
     }
     $root = mapi_msgstore_openentry($store);
     if (!$root) {
         print "Unable to open root folder\n";
         return false;
     }
     $rootprops = mapi_getprops($root, array(PR_IPM_APPOINTMENT_ENTRYID));
     $calendar = mapi_msgstore_openentry($store, $rootprops[PR_IPM_APPOINTMENT_ENTRYID]);
     $fbupdate = new FreeBusyPublish($session, $store, $calendar, $entryid);
     $fbupdate->publishFB(0, 0);
     // publish from one week ago, 6 months ahead
     return true;
 }
开发者ID:marco-uniware,项目名称:zarafa-tools,代码行数:30,代码来源:delete-freebusy.php

示例10: array

require MAPI_PATH . "mapicode.php";
require MAPI_PATH . "mapidefs.php";
require MAPI_PATH . "mapitags.php";
require MAPI_PATH . "mapiguid.php";
$supported_classes = array("IPF.Note" => "SYNC_FOLDER_TYPE_USER_MAIL", "IPF.Task" => "SYNC_FOLDER_TYPE_USER_TASK", "IPF.Appointment" => "SYNC_FOLDER_TYPE_USER_APPOINTMENT", "IPF.Contact" => "SYNC_FOLDER_TYPE_USER_CONTACT", "IPF.StickyNote" => "SYNC_FOLDER_TYPE_USER_NOTE");
$session = @mapi_logon_zarafa(ZARAFA_USER, ZARAFA_PASS, ZARAFA_SERVER);
if (!$session) {
    die("Login to Zarafa failed\n");
}
$storetable = @mapi_getmsgstorestable($session);
$storeslist = @mapi_table_queryallrows($storetable, array(PR_ENTRYID, PR_MDB_PROVIDER));
for ($i = 0; $i < count($storeslist); $i++) {
    if ($storeslist[$i][PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) {
        $publicstore = @mapi_openmsgstore($session, $storeslist[$i][PR_ENTRYID]);
        break;
    }
}
if (!isset($publicstore)) {
    die("Public folder not available");
}
$pub_folder = @mapi_msgstore_openentry($publicstore);
$h_table = @mapi_folder_gethierarchytable($pub_folder, CONVENIENT_DEPTH);
$subfolders = @mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS, PR_SOURCE_KEY));
echo "Available folders in public folder:\n" . str_repeat("-", 50) . "\n";
foreach ($subfolders as $folder) {
    if (isset($folder[PR_CONTAINER_CLASS]) && array_key_exists($folder[PR_CONTAINER_CLASS], $supported_classes)) {
        echo "Name:\t\t" . $folder[PR_DISPLAY_NAME] . "\n";
        echo "Sync-class:\t" . $supported_classes[$folder[PR_CONTAINER_CLASS]] . "\n";
        echo "PUID:\t\t" . bin2hex($folder[PR_SOURCE_KEY]) . "\n\n";
    }
}
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:31,代码来源:publicfolder.php

示例11: ImportFolderChange

 /**
  * Imports a single folder change
  *
  * @param mixed         $props     sourcekey of the changed folder
  *
  * @access public
  * @return
  */
 function ImportFolderChange($props)
 {
     $sourcekey = $props[PR_SOURCE_KEY];
     $entryid = mapi_msgstore_entryidfromsourcekey($this->store, $sourcekey);
     $mapifolder = mapi_msgstore_openentry($this->store, $entryid);
     $folder = $this->mapiprovider->GetFolder($mapifolder);
     // do not import folder if there is something "wrong" with it
     if ($folder === false) {
         return 0;
     }
     $this->importer->ImportFolderChange($folder);
     return 0;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:21,代码来源:mapiphpwrapper.php

示例12: getCorrespondentCalendarItem

 /**
  * Function returns correspondent calendar item attached with the meeting request/response/cancellation. 
  * This will only check for actual MAPIMessages in calendar folder, so if a meeting request is
  * for exception then this function will return recurring series for that meeting request
  * after that you need to use getExceptionItem function to get exception item that will be
  * fetched from the attachment table of recurring series MAPIMessage.
  * @param Boolean $open boolean to indicate the function should return entryid or MAPIMessage. Defaults to true.
  * @return entryid or MAPIMessage resource of calendar item.
  */
 function getCorrespondentCalendarItem($open = true)
 {
     $props = mapi_getprops($this->message, array(PR_MESSAGE_CLASS, $this->proptags['goid'], $this->proptags['goid2'], PR_RCVD_REPRESENTING_NAME));
     if (!$this->isMeetingRequest($props[PR_MESSAGE_CLASS]) && !$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS]) && !$this->isMeetingCancellation($props[PR_MESSAGE_CLASS])) {
         // can work only with meeting requests/responses/cancellations
         return false;
     }
     $globalId = $props[$this->proptags['goid']];
     $cleanGlobalId = $props[$this->proptags['goid2']];
     // If Delegate is processing Meeting Request/Response for Delegator then retrieve Delegator's store and calendar.
     if (isset($props[PR_RCVD_REPRESENTING_NAME])) {
         $delegatorStore = $this->getDelegatorStore($props[PR_RCVD_REPRESENTING_NAME], array(PR_IPM_APPOINTMENT_ENTRYID));
         $store = $delegatorStore['store'];
         $calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
     } else {
         $store = $this->store;
         $calFolder = $this->openDefaultCalendar();
     }
     $basedate = $this->getBasedateFromGlobalID($globalId);
     /**
      * First search for any appointments which correspond to the $globalId,
      * this can be the entire series (if the Meeting Request refers to the
      * entire series), or an particular Occurence (if the meeting Request
      * contains a basedate).
      *
      * If we cannot find a corresponding item, and the $globalId contains
      * a $basedate, it might imply that a new exception will have to be
      * created for a series which is present in the calendar, we can look
      * that one up by searching for the $cleanGlobalId. 
      */
     $entryids = $this->findCalendarItems($globalId, $calFolder);
     if ($basedate && empty($entryids)) {
         $entryids = $this->findCalendarItems($cleanGlobalId, $calFolder, true);
     }
     // there should be only one item returned
     if (!empty($entryids) && count($entryids) === 1) {
         // return only entryid
         if ($open === false) {
             return $entryids[0];
         }
         // open calendar item and return it
         return mapi_msgstore_openentry($store, $entryids[0]);
     }
     // no items found in calendar
     return false;
 }
开发者ID:tuksik,项目名称:zarafa-rest-api,代码行数:55,代码来源:class.meetingrequest.php

示例13: delete_duplicate_messages

function delete_duplicate_messages($store, $entryid)
{
    global $total_deleted;
    $folder = mapi_msgstore_openentry($store, $entryid);
    if (!$folder) {
        print "Unable to open folder.";
        return false;
    }
    $table = mapi_folder_getcontentstable($folder);
    if (!$table) {
        print "Unable to open table.";
        return false;
    }
    $org_hash = null;
    $dup_messages = array();
    $dup_count = 0;
    $result = mapi_table_sort($table, array(PR_SUBJECT => TABLE_SORT_ASCEND));
    if ($result == false) {
        die("Could not sort table\n");
    }
    while (1) {
        // query messages from folders content table
        $rows = mapi_table_queryrows($table, array(PR_MESSAGE_SIZE, PR_CLIENT_SUBMIT_TIME, PR_BODY, PR_HTML, PR_ENTRYID, PR_SUBJECT), 0, 50);
        if (count($rows) == 0) {
            break;
        }
        // we got the messages
        foreach ($rows as $row) {
            // hash message body (plaintext + html + subject)
            $md5_subject = md5($row[PR_SUBJECT]);
            $md5_body = md5($row[PR_BODY]);
            $md5_html = md5($row[PR_HTML]);
            // concat hashes, just in case there are messages with
            // no HTML or plaintext content.
            $cur_hash = $md5_body . $md5_html . $md5_subject;
            // when we have accumulated enough messages, perform a burst delete
            if ($dup_count == 50) {
                echo " [i] Deleting {$dup_count} duplicates...";
                delete_messages($folder, $dup_messages);
                // reset the delete-queue
                $dup_messages = array();
                $dup_count = 0;
                $total_deleted += 100;
                echo "done.\n";
                echo "Deleted {$total_deleted} messages so far.\n\n";
            }
            // duplicate messages are adjacent, so we push the first message with
            // a distinct hash and mark all following messages with this hash
            // for deletion.
            if ($org_hash != $cur_hash) {
                $org_hash = $cur_hash;
            } else {
                $dup_messages[] = $row[PR_ENTRYID];
                $dup_count++;
                echo " [i] For {$org_hash} adding DUP {$md5_eid} to delete list\n";
            }
        }
    }
    // final cleanup
    $dup_count = count($dup_messages);
    if ($dup_count) {
        $total_deleted += $dup_count;
        echo " [i] Finally deleting {$dup_count} duplicates. \n";
        delete_messages($folder, $dup_messages);
        $dup_messages = array();
        echo "Deleted {$total_deleted} messages so far.\n\n";
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:68,代码来源:exec.mapiSent.php

示例14: _getFoldersRecursive

 function _getFoldersRecursive($mapifolder, $parent, &$list)
 {
     $hierarchytable = mapi_folder_gethierarchytable($mapifolder);
     $folderprops = mapi_getprops($mapifolder, array(PR_ENTRYID));
     if (!$hierarchytable) {
         return false;
     }
     $rows = mapi_table_queryallrows($hierarchytable, array(PR_DISPLAY_NAME, PR_SUBFOLDERS, PR_ENTRYID));
     foreach ($rows as $row) {
         $folder = array();
         $folder["mod"] = $row[PR_DISPLAY_NAME];
         $folder["id"] = bin2hex($row[PR_ENTRYID]);
         $folder["parent"] = $parent;
         array_push($list, $folder);
         if (isset($row[PR_SUBFOLDERS]) && $row[PR_SUBFOLDERS]) {
             $this->_getFoldersRecursive(mapi_msgstore_openentry($this->_defaultstore, $row[PR_ENTRYID]), $folderprops[PR_ENTRYID], $list);
         }
     }
     return true;
 }
开发者ID:nnaannoo,项目名称:paskot,代码行数:20,代码来源:ics.php

示例15: ImportFolderChange

 /**
  * Imports a change on a folder
  *
  * @param object        $folder     SyncFolder
  *
  * @access public
  * @return string       id of the folder
  * @throws StatusException
  */
 public function ImportFolderChange($folder)
 {
     $id = isset($folder->serverid) ? $folder->serverid : false;
     $parent = $folder->parentid;
     $displayname = u2wi($folder->displayname);
     $type = $folder->type;
     if (Utils::IsSystemFolder($type)) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, system folder can not be created/modified", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname), SYNC_FSSTATUS_SYSTEMFOLDER);
     }
     // create a new folder if $id is not set
     if (!$id) {
         // the root folder is "0" - get IPM_SUBTREE
         if ($parent == "0") {
             $parentprops = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID));
             if (isset($parentprops[PR_IPM_SUBTREE_ENTRYID])) {
                 $parentfentryid = $parentprops[PR_IPM_SUBTREE_ENTRYID];
             }
         } else {
             $parentfentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($parent));
         }
         if (!$parentfentryid) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent folder (no entry id)", Utils::PrintAsString(false), $folder->parentid, $displayname), SYNC_FSSTATUS_PARENTNOTFOUND);
         }
         $parentfolder = mapi_msgstore_openentry($this->store, $parentfentryid);
         if (!$parentfolder) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent folder (open entry)", Utils::PrintAsString(false), $folder->parentid, $displayname), SYNC_FSSTATUS_PARENTNOTFOUND);
         }
         //  mapi_folder_createfolder() fails if a folder with this name already exists -> MAPI_E_COLLISION
         $newfolder = mapi_folder_createfolder($parentfolder, $displayname, "");
         if (mapi_last_hresult()) {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, mapi_folder_createfolder() failed: 0x%X", Utils::PrintAsString(false), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_FOLDEREXISTS);
         }
         mapi_setprops($newfolder, array(PR_CONTAINER_CLASS => MAPIUtils::GetContainerClassFromFolderType($type)));
         $props = mapi_getprops($newfolder, array(PR_SOURCE_KEY));
         if (isset($props[PR_SOURCE_KEY])) {
             $sourcekey = bin2hex($props[PR_SOURCE_KEY]);
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("Created folder '%s' with id: '%s'", $displayname, $sourcekey));
             return $sourcekey;
         } else {
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, folder created but PR_SOURCE_KEY not available: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
         }
         return false;
     }
     // update folder
     $entryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($id));
     if (!$entryid) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open folder (no entry id): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
     }
     $folder = mapi_msgstore_openentry($this->store, $entryid);
     if (!$folder) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open folder (open entry): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
     }
     $props = mapi_getprops($folder, array(PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_DISPLAY_NAME, PR_CONTAINER_CLASS));
     if (!isset($props[PR_SOURCE_KEY]) || !isset($props[PR_PARENT_SOURCE_KEY]) || !isset($props[PR_DISPLAY_NAME]) || !isset($props[PR_CONTAINER_CLASS])) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, folder data not available: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
     }
     if ($parent == "0") {
         $parentprops = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID));
         $parentfentryid = $parentprops[PR_IPM_SUBTREE_ENTRYID];
         $mapifolder = mapi_msgstore_openentry($this->store, $parentfentryid);
         $rootfolderprops = mapi_getprops($mapifolder, array(PR_SOURCE_KEY));
         $parent = bin2hex($rootfolderprops[PR_SOURCE_KEY]);
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesICS->ImportFolderChange(): resolved AS parent '0' to sourcekey '%s'", $parent));
     }
     // In theory the parent id could change, which means that the folder was moved.
     // It is unknown if any device supports this, so we do currently not implement it (no known device is able to do this)
     if (bin2hex($props[PR_PARENT_SOURCE_KEY]) !== $parent) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Folder was moved to another location, which is currently not supported. Please report this to the Z-Push dev team together with the WBXML log and your device details (model, firmware etc).", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_UNKNOWNERROR);
     }
     $props = array(PR_DISPLAY_NAME => $displayname);
     mapi_setprops($folder, $props);
     mapi_savechanges($folder);
     if (mapi_last_hresult()) {
         throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, mapi_savechanges() failed: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
     }
     ZLog::Write(LOGLEVEL_DEBUG, "Imported changes for folder: {$id}");
     return $id;
 }
开发者ID:netconstructor,项目名称:sogosync,代码行数:87,代码来源:importer.php


注:本文中的mapi_msgstore_openentry函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。