How to get calendar owner for an appointment - VCL

Add-in Express™ Support Service
That's what is more important than anything else

How to get calendar owner for an appointment - VCL
 
biG dada




Posts: 7
Joined: 2011-04-06
hi all.
i'm trying to get calendar owner's smtp address from AppointmentItem.
i used the following code:

   OutlookAppObj.ActiveInspector.CurrentItem.QueryInterface(IID__AppointmentItem, appt);
   if Assigned(appt) then
     email:=appt.Recipients.Item(1).AddressEntry.GetExchangeUser.PrimarySmtpAddress;


in some point in time it stopped working, and appt.Recipients.Count became "0".
i found a forum post titled :" How to get calendar owner for an appointment", but i couldnt figure out how to port the suggested code to delphi ( i'm using delphi 7 , btw). the code uses adxmapiStoreAccessor which i believe it is not included in VCL components.

Any ideas ?
Posted 06 Apr, 2011 03:07:27 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi,

In what event handler do you execute your code? Could you please give me more information about that time point when your code stopped working? What exactly is happening in that moment? Is an appointment item closing?
Posted 06 Apr, 2011 09:03:22 Top
biG dada




Posts: 7
Joined: 2011-04-06
the code is in private function which is called by onclick event of a button placed on TadxOlForm.
i have no idea when it stopped working , i suspect it has something to do with an outlook hotfix. i cant investigate is, and, frankly - i think it's a waste of time.
the appointment is not closing because it's not supposed to - i just need to get the calendar owner in order to update my CRM database with this info.
Posted 06 Apr, 2011 11:34:58 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Thank you for the details.

I the .NET forum topic you mentioned earlier, the usage of the Extended MAPI properties is discussed. So, I think you can also try to use Extended MAPI in your code. I have just opened an existing appointment in my Outlook 2010 and can see the PR_SENDER_EMAIL_ADDRESS_W and PR_SENT_REPRESENTING_EMAIL_ADDRESS_W properties that contain my email address.

Also, please have a look at the SendUsingAccount property of the Outlook Object Model. Probably you will be able to use it when Recipients.Count is equal to 0.
Posted 06 Apr, 2011 12:18:41 Top
biG dada




Posts: 7
Joined: 2011-04-06
thanks for the quick response.
SendUsingAccount will not provide me with the correct info in case the appointment is in shared calendar.
which brings me to my next question : do you have a working example of accessing extended mapi properties, (or, to be more exact - _PR_MAILBOX_OWNER_NAME property) from delphi or c++ builder ?
Posted 06 Apr, 2011 15:21:35 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
We don't have a ready made sample that accesses the PR_MAILBOX_OWNER_NAME property.

But please have a look at this http://www.add-in-express.com/free-addins/delphi-outlook-addin.php. There is a Delphi sample add-in that uses Extended MAPI to get access to the PR_TRANSPORT_MESSAGE_HEADERS and PR_BODY properties. I hope it will be useful.
Posted 07 Apr, 2011 08:04:33 Top
biG dada




Posts: 7
Joined: 2011-04-06
i already have this example.
if i understand correctly, this example shows how to get extended mapi properties from message level. i need to get a mapi property of a store level, and i dont think it's exposed in the included mapiutils units.
Posted 07 Apr, 2011 08:53:18 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Sorry, but as I mentioned earlier, we don't have exactly the sample that you need.
Posted 07 Apr, 2011 11:49:43 Top
biG dada




Posts: 7
Joined: 2011-04-06
this is not about the sample. i suspect you do not fully understand the functionality i need. getting the owner of calendar is one of the most trivial requirements for an outlook - based solution. in fact, you do provide it for .NET solutions. looks like your VCL component is really crippled, i almost regret i bought it.
Posted 13 Apr, 2011 04:09:08 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Firstly, I can say that Add-in Express for VCL and Add-in Express for .NET have very similar functionality. VCL version does not support XLLs and 64-bit versions of Office applications. That's the whole difference.

Secondly, I hope you understand that the Outlook Object Model does not provide a property which you (and we, and any other developers) can use to get "owner of calendar". To get the owner, you will have to use Extended MAPI functions and interfaces both in NET and VCL. Using Extended MAPI is not a trivial task for Win32 developers and even more complicated for .NET developers. That is why we developed a separate, free product for .NET developers - MAPI Store Accessor. In the sample you mentioned this product is used.

But in general you are right, I really don't understand the functionality you need because you never described it. Please email me all possible details about your task, I will try to create a sample for you, hopefully it will be useful for all our customers as well.
Posted 13 Apr, 2011 08:53:42 Top