本文整理汇总了PHP中mapi_getmsgstorestable函数的典型用法代码示例。如果您正苦于以下问题:PHP mapi_getmsgstorestable函数的具体用法?PHP mapi_getmsgstorestable怎么用?PHP mapi_getmsgstorestable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mapi_getmsgstorestable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zpa_zarafa_admin_setup
function zpa_zarafa_admin_setup($mapi, $user, $pass)
{
require PHP_MAPI_PATH . 'mapi.util.php';
require PHP_MAPI_PATH . 'mapidefs.php';
require PHP_MAPI_PATH . 'mapicode.php';
require PHP_MAPI_PATH . 'mapitags.php';
require PHP_MAPI_PATH . 'mapiguid.php';
$session = @mapi_logon_zarafa($user, $pass, $mapi);
if (!$session) {
echo "User '{$user}' could not login. The script will exit. Errorcode: 0x" . sprintf("%x", mapi_last_hresult()) . "\n";
exit(1);
}
$stores = @mapi_getmsgstorestable($session);
$storeslist = @mapi_table_queryallrows($stores);
$adminStore = @mapi_openmsgstore($session, $storeslist[0][PR_ENTRYID]);
if (!$stores || !$storeslist || !$adminStore) {
echo "There was error trying to log in as admin or retrieving admin info. The script will exit.\n";
exit(1);
}
return array("session" => $session, "adminStore" => $adminStore);
}
示例2: ScanMailBox
function ScanMailBox($uid)
{
$ct = new user($uid);
$sock = new sockets();
$username = $uid;
$password = $ct->password;
$zarafa_sock = "file:///var/run/zarafa";
$ZarafaServerListenIP = $sock->GET_INFO("ZarafaServerListenIP");
if ($ZarafaServerListenIP == null) {
$ZarafaServerListenIP = "127.0.0.1";
}
if ($ZarafaServerListenIP == "0.0.0.0") {
$ZarafaServerListenIP = "127.0.0.1";
}
$ZarafaServerListenPort = intval($sock->GET_INFO("ZarafaServerListenPort"));
if ($ZarafaServerListenPort == 0) {
$ZarafaServerListenPort = 236;
}
$zarafaServer = "http://{$ZarafaServerListenIP}:{$ZarafaServerListenPort}/zarafa";
$session = mapi_logon_zarafa($username, $password, $zarafaServer);
$hard_delete_messages = true;
$folder_to_process = 'Sent Items';
$total_deleted = 0;
if (!$session) {
print "Unable to open session {$username}@{$zarafaServer} `{$password}`\n";
return;
}
$msgstorestable = mapi_getmsgstorestable($session);
if (!$msgstorestable) {
print "Unable to open message stores table\n";
return;
}
$msgstores = mapi_table_queryallrows($msgstorestable, array(PR_DEFAULT_STORE, PR_ENTRYID));
foreach ($msgstores as $row) {
if ($row[PR_DEFAULT_STORE]) {
$default_store_entry_id = $row[PR_ENTRYID];
}
}
$default_store = mapi_openmsgstore($session, $default_store_entry_id);
if (!$default_store) {
print "Unable to open default store\n";
exit(1);
}
$root = mapi_msgstore_openentry($default_store);
// get folders
$folders = mapi_folder_gethierarchytable($root, CONVENIENT_DEPTH);
// loop over every folder
while (1) {
$rows = mapi_table_queryrows($folders, array(PR_DISPLAY_NAME, PR_FOLDER_TYPE, PR_ENTRYID), 0, 100);
if (count($rows) == 0) {
break;
}
foreach ($rows as $row) {
// skip searchfolders
if (isset($row[PR_FOLDER_TYPE]) && $row[PR_FOLDER_TYPE] == FOLDER_SEARCH) {
continue;
}
// operate only on folders, whose name is specified in the config section.
// Like 'Sent Objects'.
if ($row[PR_DISPLAY_NAME] == $folder_to_process) {
parse_messages($default_store, $row[PR_ENTRYID]);
}
}
}
}
示例3: _openDefaultMessageStore
function _openDefaultMessageStore($session)
{
// Find the default store
$storestables = mapi_getmsgstorestable($session);
$result = mapi_last_hresult();
$entryid = false;
if ($result == NOERROR) {
$rows = mapi_table_queryallrows($storestables, array(PR_ENTRYID, PR_DEFAULT_STORE, PR_MDB_PROVIDER));
foreach ($rows as $row) {
if (isset($row[PR_DEFAULT_STORE]) && $row[PR_DEFAULT_STORE] == true) {
$entryid = $row[PR_ENTRYID];
break;
}
}
}
if ($entryid) {
return mapi_openmsgstore($session, $entryid);
} else {
return false;
}
}
示例4: openMessageStore
/**
* Open the store marked with PR_DEFAULT_STORE = TRUE
* if $return_public is set, the public store is opened
*
* @param string $user User which store should be opened
*
* @access public
* @return boolean
*/
private function openMessageStore($user)
{
// During PING requests the operations store has to be switched constantly
// the cache prevents the same store opened several times
if (isset($this->storeCache[$user])) {
return $this->storeCache[$user];
}
$entryid = false;
$return_public = false;
if (strtoupper($user) == 'SYSTEM') {
$return_public = true;
}
// loop through the storestable if authenticated user of public folder
if ($user == $this->mainUser || $return_public === true) {
// Find the default store
$storestables = mapi_getmsgstorestable($this->session);
$result = mapi_last_hresult();
if ($result == NOERROR) {
$rows = mapi_table_queryallrows($storestables, array(PR_ENTRYID, PR_DEFAULT_STORE, PR_MDB_PROVIDER));
foreach ($rows as $row) {
if (!$return_public && isset($row[PR_DEFAULT_STORE]) && $row[PR_DEFAULT_STORE] == true) {
$entryid = $row[PR_ENTRYID];
break;
}
if ($return_public && isset($row[PR_MDB_PROVIDER]) && $row[PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) {
$entryid = $row[PR_ENTRYID];
break;
}
}
}
} else {
$entryid = @mapi_msgstore_createentryid($this->defaultstore, $user);
}
if ($entryid) {
$store = @mapi_openmsgstore($this->session, $entryid);
if (!$store) {
ZLog::Write(LOGLEVEL_WARN, sprintf("ZarafaBackend->openMessageStore('%s'): Could not open store", $user));
return false;
}
// add this store to the cache
if (!isset($this->storeCache[$user])) {
$this->storeCache[$user] = $store;
}
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->openMessageStore('%s'): Found '%s' store: '%s'", $user, $return_public ? 'PUBLIC' : 'DEFAULT', $store));
return $store;
} else {
ZLog::Write(LOGLEVEL_WARN, sprintf("ZarafaBackend->openMessageStore('%s'): No store found for this user", $user));
return false;
}
}
示例5: getDefaultStore
function getDefaultStore()
{
$table = mapi_getmsgstorestable($this->session);
$rows = mapi_table_queryallrows($table, array(PR_DEFAULT_STORE, PR_ENTRYID));
foreach ($rows as $row) {
if ($row[PR_DEFAULT_STORE]) {
return mapi_openmsgstore($this->session, $row[PR_ENTRYID]);
}
}
return false;
}
示例6: getdefaultstore
function getdefaultstore()
{
$this->msgstorestable = mapi_getmsgstorestable($this->session);
if (!$this->msgstorestable) {
print "Unable to open message stores table\n";
exit(RESULT_ERROR_OPEN_MESSAGE_STORE_TABLE);
}
$this->msgstores = mapi_table_queryallrows($this->msgstorestable, array(PR_DEFAULT_STORE, PR_ENTRYID));
foreach ($this->msgstores as $row) {
if ($row[PR_DEFAULT_STORE]) {
$this->storeentryid = $row[PR_ENTRYID];
}
}
if (!$this->storeentryid) {
print "Can't find default store\n";
exit(RESULT_ERROR_NO_DEFAULT_STORE);
}
}
示例7: define
define('PR_CREATION_TIME', mapi_prop_tag(PT_SYSTIME, 0x3007));
function greaterDate($start_date, $daysBeforeDeleted)
{
return strtotime($start_date) - strtotime(date('Y-m-d G:i:s', strtotime("-{$daysBeforeDeleted} days"))) < 0 ? 1 : 0;
}
// Add the SVN revision number to the version
$mapi_version = str_replace('-', '.', phpversion('mapi'));
// Log in to Zarafa server
if (version_compare($mapi_version, '7.2.0.46424', '>=')) {
$l_rSession = mapi_logon_zarafa($l_sUsername, $l_sPassword, $l_sServer, NULL, NULL, NULL, NULL);
} else {
$l_rSession = mapi_logon_zarafa($l_sUsername, $l_sPassword, $l_sServer);
}
echo (mapi_last_hresult() == 0 ? "Logged in successfully" : "Some error in login") . "\n";
// Get a table with the message stores within this session
$l_rTableStores = mapi_getmsgstorestable($l_rSession);
echo (mapi_last_hresult() == 0 ? "Processing to get data... " : "Some error in processing...") . "\n";
// Retrieve the default store by querying the table
$l_aTableRows = mapi_table_queryallrows($l_rTableStores, array(PR_ENTRYID, PR_DEFAULT_STORE));
echo (mapi_last_hresult() == 0 ? "Fetching Deleted Folder..." : "Some error in fetching...") . "\n";
$l_bbnEntryID = false;
// Either boolean or binary
// Loop through returned rows
for ($i = 0; $i < count($l_aTableRows); $i++) {
// Check to see if this entry is the default store
if (isset($l_aTableRows[$i][PR_DEFAULT_STORE]) && $l_aTableRows[$i][PR_DEFAULT_STORE] == true) {
$storeEntryId = $l_aTableRows[$i][PR_ENTRYID];
break;
}
}
// check if default root store's entry id found
示例8: openMsgStore
function openMsgStore($username, $password)
{
$session = mapi_logon_zarafa($username, $password, SERVER);
if (mapi_last_hresult() != 0) {
trigger_error(sprintf("MAPI Error: 0x%x", mapi_last_hresult()), E_USER_ERROR);
}
$storesTable = mapi_getmsgstorestable($session);
$stores = mapi_table_queryallrows($storesTable, array(PR_ENTRYID, PR_MDB_PROVIDER));
for ($i = 0; $i < count($stores); $i++) {
if ($stores[$i][PR_MDB_PROVIDER] == ZARAFA_SERVICE_GUID) {
$storeEntryid = $stores[$i][PR_ENTRYID];
break;
}
}
if (!isset($storeEntryid)) {
trigger_error("Default store not found", E_USER_ERROR);
}
$store = mapi_openmsgstore($session, $storeEntryid);
isUnicodeStore($store);
return $store;
}
示例9: connect
/**
* Connect to Zarafa and do some init
* @param $user user login
* @param $password user password
*/
public function connect($user, $password)
{
$this->logger->debug("connect({$user}," . md5($password) . ")");
$this->session = NULL;
try {
$session = mapi_logon_zarafa($user, $password, ZARAFA_SERVER);
} catch (Exception $e) {
$this->logger->debug("connection failed: " . get_mapi_error_name());
return false;
}
if ($session === FALSE) {
// Failed
return false;
}
$this->logger->trace("Connected to zarafa server - init bridge");
$this->session = $session;
// Find user store
$storesTable = mapi_getmsgstorestable($session);
$stores = mapi_table_queryallrows($storesTable, array(PR_ENTRYID, PR_MDB_PROVIDER));
for ($i = 0; $i < count($stores); $i++) {
switch ($stores[$i][PR_MDB_PROVIDER]) {
case ZARAFA_SERVICE_GUID:
$storeEntryid = $stores[$i][PR_ENTRYID];
break;
case ZARAFA_STORE_PUBLIC_GUID:
$pubStoreEntryid = $stores[$i][PR_ENTRYID];
break;
}
}
if (!isset($storeEntryid)) {
trigger_error("Default store not found", E_USER_ERROR);
}
$this->store = mapi_openmsgstore($this->session, $storeEntryid);
$root = mapi_msgstore_openentry($this->store, null);
$rootProps = mapi_getprops($root, array(PR_IPM_CONTACT_ENTRYID));
// Store rootfolder
$this->rootFolder = mapi_msgstore_openentry($this->store, $rootProps[PR_IPM_CONTACT_ENTRYID]);
$this->rootFolderId = $rootProps[PR_IPM_CONTACT_ENTRYID];
if (isset($pubStoreEntryid)) {
$this->pubStore = mapi_openmsgstore($this->session, $pubStoreEntryid);
$pubFolder = mapi_msgstore_openentry($this->pubStore);
$h_table = mapi_folder_gethierarchytable($pubFolder, CONVENIENT_DEPTH);
// $subfolders = mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME));
$subfolders = mapi_table_queryallrows($h_table);
for ($i = 0; $i < count($subfolders); $i++) {
$name = $subfolders[$i][PR_DISPLAY_NAME];
$entryid = $subfolders[$i][PR_ENTRYID];
$folder = mapi_msgstore_openentry($this->pubStore, $entryid);
$props = mapi_getprops($folder);
if (isset($props[PR_CONTAINER_CLASS_A]) && $props[PR_CONTAINER_CLASS_A] == "IPF.Contact") {
$this->pubFolderIds[] = $entryid;
$this->pubFolders[] = mapi_msgstore_openentry($this->pubStore, $entryid);
}
}
}
// Check for unicode
$this->isUnicodeStore($this->store);
// Load properties
$this->initProperties();
// Store username for principals
$this->connectedUser = $user;
// Set protected variable to NULL.
$this->adressBooks = NULL;
return true;
}
示例10: resolveRecipientContact
/**
* Resolves recipient from the contact list and gets his certificates.
*
* @param string $to
*
* @return SyncResolveRecipient|boolean
*/
private function resolveRecipientContact($to)
{
// go through all contact folders of the user and
// check if there's a contact with the given email address
$root = mapi_msgstore_openentry($this->defaultstore);
if (!$root) {
ZLog::Write(LOGLEVEL_ERROR, sprintf("Unable to open default store: 0x%X", mapi_last_hresult));
}
$rootprops = mapi_getprops($root, array(PR_IPM_CONTACT_ENTRYID));
$contacts = $this->getContactsFromFolder($this->defaultstore, $rootprops[PR_IPM_CONTACT_ENTRYID], $to);
$recipients = array();
if ($contacts !== false) {
// create resolve recipient object
foreach ($contacts as $contact) {
$certificates = isset($contact[PR_USER_X509_CERTIFICATE]) && is_array($contact[PR_USER_X509_CERTIFICATE]) && count($contact[PR_USER_X509_CERTIFICATE]) ? $this->getCertificates($contact[PR_USER_X509_CERTIFICATE], 1) : false;
if ($certificates !== false) {
return $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_CONTACT, u2w($contact[PR_DISPLAY_NAME]), $to, $certificates);
}
}
}
$contactfolder = mapi_msgstore_openentry($this->defaultstore, $rootprops[PR_IPM_CONTACT_ENTRYID]);
$subfolders = MAPIUtils::GetSubfoldersForType($contactfolder, "IPF.Contact");
foreach ($subfolders as $folder) {
$contacts = $this->getContactsFromFolder($this->defaultstore, $folder[PR_ENTRYID], $to);
if ($contacts !== false) {
foreach ($contacts as $contact) {
$certificates = isset($contact[PR_USER_X509_CERTIFICATE]) && is_array($contact[PR_USER_X509_CERTIFICATE]) && count($contact[PR_USER_X509_CERTIFICATE]) ? $this->getCertificates($contact[PR_USER_X509_CERTIFICATE], 1) : false;
if ($certificates !== false) {
return $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_CONTACT, u2w($contact[PR_DISPLAY_NAME]), $to, $certificates);
}
}
}
}
// search contacts in public folders
$storestables = mapi_getmsgstorestable($this->session);
$result = mapi_last_hresult();
if ($result == NOERROR) {
$rows = mapi_table_queryallrows($storestables, array(PR_ENTRYID, PR_DEFAULT_STORE, PR_MDB_PROVIDER));
foreach ($rows as $row) {
if (isset($row[PR_MDB_PROVIDER]) && $row[PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) {
// TODO refactor public store
$publicstore = mapi_openmsgstore($this->session, $row[PR_ENTRYID]);
$publicfolder = mapi_msgstore_openentry($publicstore);
$subfolders = MAPIUtils::GetSubfoldersForType($publicfolder, "IPF.Contact");
if ($subfolders !== false) {
foreach ($subfolders as $folder) {
$contacts = $this->getContactsFromFolder($publicstore, $folder[PR_ENTRYID], $to);
if ($contacts !== false) {
foreach ($contacts as $contact) {
$certificates = isset($contact[PR_USER_X509_CERTIFICATE]) && is_array($contact[PR_USER_X509_CERTIFICATE]) && count($contact[PR_USER_X509_CERTIFICATE]) ? $this->getCertificates($contact[PR_USER_X509_CERTIFICATE], 1) : false;
if ($certificates !== false) {
return $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_CONTACT, u2w($contact[PR_DISPLAY_NAME]), $to, $certificates);
}
}
}
}
}
break;
}
}
} else {
ZLog::Write(LOGLEVEL_WARN, sprintf("Unable to open public store: 0x%X", $result));
}
$certificates = $this->getCertificates(false);
return $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_CONTACT, $to, $to, $certificates);
}
示例11: define
}
define("MAPI_PATH", "/usr/share/php/mapi/");
define("ZARAFA_SERVER", "file:///var/run/zarafa");
define("ZARAFA_USER", "SYSTEM");
define("ZARAFA_PASS", "");
require MAPI_PATH . "mapi.util.php";
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) {
示例12: open_zarafa
/**
* open_zarafa
*
* @param descriptor An open Zarafa session id.
* @return array Array with session and store information.
*/
function open_zarafa($session)
{
$ret = array("root" => "/");
$storesTable = mapi_getmsgstorestable($session);
$stores = mapi_table_queryallrows($storesTable, array(PR_ENTRYID, PR_MDB_PROVIDER));
for ($i = 0; $i < count($stores); $i++) {
if ($stores[$i][PR_MDB_PROVIDER] == ZARAFA_SERVICE_GUID) {
$storeEntryid = $stores[$i][PR_ENTRYID];
break;
}
}
if (!isset($storeEntryid)) {
trigger_error("Default store not found", PR_USER_ERROR);
}
$store = mapi_openmsgstore($session, $storeEntryid);
$root = mapi_msgstore_openentry($store, null);
$rootProps = mapi_getprops($root, array(PR_IPM_CONTACT_ENTRYID));
$folder = mapi_msgstore_openentry($store, $rootProps[PR_IPM_CONTACT_ENTRYID]);
$table = mapi_folder_getcontentstable($folder);
$contacts = mapi_table_queryallrows($table);
$ret["session"] = $session;
$ret["store"] = $store;
$ret["contacts"] = $contacts;
// ZCP 7 and up know unicode...
$supportmask = mapi_getprops($store, array(PR_STORE_SUPPORT_MASK));
if (isset($supportmask[PR_STORE_SUPPORT_MASK]) && $supportmask[PR_STORE_SUPPORT_MASK] & STORE_UNICODE_OK) {
$ret["unicode_store"] = true;
setlocale(LC_CTYPE, 'en_US.utf-8');
}
// END ZCP7 and up know unicode
return $ret;
}
示例13: listfolders_getlist
function listfolders_getlist($adminStore, $session, $user)
{
global $supported_classes;
if (strtoupper($user) == 'SYSTEM') {
// Find the public store store
$storestables = @mapi_getmsgstorestable($session);
$result = @mapi_last_hresult();
if ($result == NOERROR) {
$rows = @mapi_table_queryallrows($storestables, array(PR_ENTRYID, PR_MDB_PROVIDER));
foreach ($rows as $row) {
if (isset($row[PR_MDB_PROVIDER]) && $row[PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) {
if (!isset($row[PR_ENTRYID])) {
echo "Public folder are not available.\nIf this is a multi-tenancy system, use -u and -p and login with an admin user of the company.\nThe script will exit.\n";
exit(1);
}
$entryid = $row[PR_ENTRYID];
break;
}
}
}
} else {
$entryid = @mapi_msgstore_createentryid($adminStore, $user);
}
$userStore = @mapi_openmsgstore($session, $entryid);
$hresult = mapi_last_hresult();
// Cache the store for later use
if ($hresult != NOERROR) {
echo "Could not open store for '{$user}'. The script will exit.\n";
exit(1);
}
if (strtoupper($user) != 'SYSTEM') {
$inbox = mapi_msgstore_getreceivefolder($userStore);
if (mapi_last_hresult() != NOERROR) {
printf("Could not open inbox for %s (0x%08X). The script will exit.\n", $user, mapi_last_hresult());
exit(1);
}
$inboxProps = mapi_getprops($inbox, array(PR_SOURCE_KEY));
}
$storeProps = mapi_getprops($userStore, array(PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID, PR_IPM_WASTEBASKET_ENTRYID));
$root = @mapi_msgstore_openentry($userStore, null);
$h_table = @mapi_folder_gethierarchytable($root, CONVENIENT_DEPTH);
$subfolders = @mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_FOLDER_TYPE, PR_ATTR_HIDDEN));
echo "Available folders in store '{$user}':\n" . str_repeat("-", 50) . "\n";
foreach ($subfolders as $folder) {
// do not display hidden and search folders
if (isset($folder[PR_ATTR_HIDDEN]) && $folder[PR_ATTR_HIDDEN] || isset($folder[PR_FOLDER_TYPE]) && $folder[PR_FOLDER_TYPE] == FOLDER_SEARCH) {
continue;
}
// handle some special folders
if (strtoupper($user) != 'SYSTEM' && (isset($inboxProps[PR_SOURCE_KEY]) && $folder[PR_SOURCE_KEY] == $inboxProps[PR_SOURCE_KEY] || $folder[PR_ENTRYID] == $storeProps[PR_IPM_SENTMAIL_ENTRYID] || $folder[PR_ENTRYID] == $storeProps[PR_IPM_WASTEBASKET_ENTRYID])) {
$folder[PR_CONTAINER_CLASS] = "IPF.Note";
}
if (isset($folder[PR_CONTAINER_CLASS]) && array_key_exists($folder[PR_CONTAINER_CLASS], $supported_classes)) {
echo "Folder name:\t" . $folder[PR_DISPLAY_NAME] . "\n";
echo "Folder ID:\t" . bin2hex($folder[PR_SOURCE_KEY]) . "\n";
echo "Type:\t\t" . $supported_classes[$folder[PR_CONTAINER_CLASS]] . "\n";
echo "\n";
}
}
}
示例14: openDefaultStore
function openDefaultStore()
{
$storestable = mapi_getmsgstorestable($this->session);
$rows = mapi_table_queryallrows($storestable, array(PR_ENTRYID, PR_DEFAULT_STORE));
$entry = false;
foreach ($rows as $row) {
if (isset($row[PR_DEFAULT_STORE]) && $row[PR_DEFAULT_STORE]) {
$entryid = $row[PR_ENTRYID];
break;
}
}
if (!$entryid) {
return false;
}
return mapi_openmsgstore($this->session, $entryid);
}
示例15: listfolders_getlist
function listfolders_getlist($adminStore, $session, $user)
{
global $supported_classes;
if (strtoupper($user) == 'SYSTEM') {
// Find the public store store
$storestables = @mapi_getmsgstorestable($session);
$result = @mapi_last_hresult();
if ($result == NOERROR) {
$rows = @mapi_table_queryallrows($storestables, array(PR_ENTRYID, PR_MDB_PROVIDER));
foreach ($rows as $row) {
if (isset($row[PR_MDB_PROVIDER]) && $row[PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) {
if (!isset($row[PR_ENTRYID])) {
echo "Public folder are not available.\nIf this is a multi-tenancy system, use -u and -p and login with an admin user of the company.\nThe script will exit.\n";
exit(1);
}
$entryid = $row[PR_ENTRYID];
break;
}
}
}
} else {
$entryid = @mapi_msgstore_createentryid($adminStore, $user);
}
$userStore = @mapi_openmsgstore($session, $entryid);
$hresult = mapi_last_hresult();
// Cache the store for later use
if ($hresult != NOERROR) {
echo "Could not open store for '{$user}'. The script will exit.\n";
exit(1);
}
$folder = @mapi_msgstore_openentry($userStore);
$h_table = @mapi_folder_gethierarchytable($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 store '{$user}':\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 "Folder name:\t" . $folder[PR_DISPLAY_NAME] . "\n";
echo "Folder ID:\t" . bin2hex($folder[PR_SOURCE_KEY]) . "\n";
echo "Type:\t\t" . $supported_classes[$folder[PR_CONTAINER_CLASS]] . "\n";
echo "\n";
}
}
}