@@ -1729,15 +1729,21 @@ private function setAppointment($mapimessage, $appointment) {
17291729 $ appointmentprops ["sentrepresentingemail " ], $ appointmentprops ["sentrepresentinsrchk " ], $ appointmentprops ["responsestatus " ], ];
17301730 $ representingprops = $ this ->getProps ($ mapimessage , $ p );
17311731
1732+ $ storeProps = $ this ->GetStoreProps ();
1733+ $ abEntryProps = $ this ->getAbPropsFromEntryID ($ storeProps [PR_MAILBOX_OWNER_ENTRYID ]);
17321734 if (!isset ($ representingprops [$ appointmentprops ["representingentryid " ]])) {
1733- // TODO use GetStoreProps
1734- $ storeProps = mapi_getprops ($ this ->store , [PR_MAILBOX_OWNER_ENTRYID ]);
1735- $ props [$ appointmentprops ["representingentryid " ]] = $ storeProps [PR_MAILBOX_OWNER_ENTRYID ];
1736- $ displayname = $ this ->getFullnameFromEntryID ($ storeProps [PR_MAILBOX_OWNER_ENTRYID ]);
1735+ $ displayname = $ sentrepresentingemail = Request::GetUser ();
1736+ $ sentrepresentingaddt = 'SMPT ' ;
1737+ if ($ abEntryProps !== false ) {
1738+ $ displayname = $ abEntryProps [PR_DISPLAY_NAME ] ?? $ displayname ;
1739+ $ sentrepresentingemail = $ abEntryProps [PR_EMAIL_ADDRESS ] ?? $ abEntryProps [PR_SMTP_ADDRESS ] ?? $ sentrepresentingemail ;
1740+ $ sentrepresentingaddt = $ abEntryProps [PR_ADDRTYPE ] ?? $ sentrepresentingaddt ;
1741+ }
17371742
1738- $ props [$ appointmentprops ["representingname " ]] = ($ displayname !== false ) ? $ displayname : Request::GetUser ();
1739- $ props [$ appointmentprops ["sentrepresentingemail " ]] = Request::GetUser ();
1740- $ props [$ appointmentprops ["sentrepresentingaddt " ]] = "ZARAFA " ;
1743+ $ props [$ appointmentprops ["representingentryid " ]] = $ storeProps [PR_MAILBOX_OWNER_ENTRYID ];
1744+ $ props [$ appointmentprops ["representingname " ]] = $ displayname ;
1745+ $ props [$ appointmentprops ["sentrepresentingemail " ]] = $ sentrepresentingemail ;
1746+ $ props [$ appointmentprops ["sentrepresentingaddt " ]] = $ sentrepresentingaddt ;
17411747 $ props [$ appointmentprops ["sentrepresentinsrchk " ]] = $ props [$ appointmentprops ["sentrepresentingaddt " ]] . ": " . $ props [$ appointmentprops ["sentrepresentingemail " ]];
17421748
17431749 if (isset ($ appointment ->attendees ) && is_array ($ appointment ->attendees ) && !empty ($ appointment ->attendees )) {
@@ -2592,26 +2598,20 @@ private function getSMTPAddressFromEntryID($entryid) {
25922598 }
25932599
25942600 /**
2595- * Returns fullname from an entryid.
2601+ * Returns AB data from an entryid.
25962602 *
2597- * @param binary $entryid
2603+ * @param string $entryid
25982604 *
2599- * @return string fullname or false on error
2605+ * @return mixed
26002606 */
2601- private function getFullnameFromEntryID ($ entryid ) {
2607+ private function getAbPropsFromEntryID ($ entryid ) {
26022608 $ addrbook = $ this ->getAddressbook ();
26032609 $ mailuser = mapi_ab_openentry ($ addrbook , $ entryid );
2604- if (!$ mailuser ) {
2605- SLog::Write (LOGLEVEL_ERROR , sprintf ("Unable to get mailuser for getFullnameFromEntryID (0x%X) " , mapi_last_hresult ()));
2606-
2607- return false ;
2610+ if ($ mailuser ) {
2611+ return mapi_getprops ($ mailuser , [PR_DISPLAY_NAME , PR_ADDRTYPE , PR_SMTP_ADDRESS , PR_EMAIL_ADDRESS ]);
26082612 }
26092613
2610- $ props = mapi_getprops ($ mailuser , [PR_DISPLAY_NAME ]);
2611- if (isset ($ props [PR_DISPLAY_NAME ])) {
2612- return $ props [PR_DISPLAY_NAME ];
2613- }
2614- SLog::Write (LOGLEVEL_ERROR , sprintf ("Unable to get fullname for getFullnameFromEntryID (0x%X) " , mapi_last_hresult ()));
2614+ SLog::Write (LOGLEVEL_ERROR , sprintf ("MAPIProvider->getAbPropsFromEntryID(): Unable to get mailuser (0x%X) " , mapi_last_hresult ()));
26152615
26162616 return false ;
26172617 }
0 commit comments