#!/usr/bin/php getCode(); return $e->getCode(); } break; } } } // get settings // first check if property exist and we can open that using mapi_openproperty $storeProps = mapi_getprops($userstore, array(PR_EC_WEBACCESS_SETTINGS_JSON)); // Check if property exists, if it doesn not exist then we can continue with empty set of settings if (isset($storeProps[PR_EC_WEBACCESS_SETTINGS_JSON]) || propIsError(PR_EC_WEBACCESS_SETTINGS_JSON, $storeProps) == MAPI_E_NOT_ENOUGH_MEMORY) { // read the settings property $stream = mapi_openproperty($userstore, PR_EC_WEBACCESS_SETTINGS_JSON, IID_IStream, 0, 0); if ($stream == false) { echo "Error opening settings property\n"; } $settings_string = ""; $stat = mapi_stream_stat($stream); mapi_stream_seek($stream, 0, STREAM_SEEK_SET); for ($i = 0; $i < $stat['cb']; $i += 1024) { $settings_string .= mapi_stream_read($stream, 1024); } if(empty($settings_string)) { // property exists but without any content so ignore it and continue with // empty set of settings return; } $settings = json_decode($settings_string, true); if (empty($settings) || empty($settings['settings'])) { echo "Error retrieving existing settings\n"; } $calcontext = $settings["settings"]["zarafa"]["v1"]["contexts"]["calendar"]; if(isset($calcontext["icssync"])) { foreach($calcontext["icssync"] as $syncitem) { echo $syncitem["icsurl"] . "
"; } } else { echo "no sync items"; } } ?>