Cannot read Property set in MeetingRequest via PropertyAccessor

  • Thread starter Upul Samaranayake
  • Start date
U

Upul Samaranayake

I am setting a custom property via a button click event, which I try to read
in Item_send. This works for fine mail items (IPM.Note). But it does NOT work
for MeetingRequests. The property gets set successfully by SetProperty method
(it is visible via OutlookSpy). But it cannot be found when trying to read
via "GetProperty" method from within Item_Send event.

Any ideas would be appreciated. TIA.

Here is the relavent part of the code:
----------------------
OnbtnMyButton(ByVal control As Office.IRibbonControl, ByVal isPressed As
Boolean)
Dim objApp As Microsoft.Office.Interop.Outlook.Application
Dim objInsp As Microsoft.Office.Interop.Outlook.Inspector
Dim objItem As Object
Dim objPA As Microsoft.Office.Interop.Outlook.PropertyAccessor
Dim strPropSchema As String =
"http://schemas.microsoft.com/mapi/string/{2516bae8-2064-4d58-9dc3-6cdd1058f8d1}/ButtonState"
objApp = Globals.ThisAddIn.Application
objInsp = objApp.ActiveInspector
objItem = objInsp.CurrentItem
objPA = objItem.PropertyAccessor
If isPressed Then
objPA.SetProperty(strPropSchema, "Pressed")
Else
objPA.SetProperty(strPropSchema, "UnPressed")
End If
objPA = Nothing
objItem = Nothing
objInsp = Nothing
objApp = Nothing
End Sub

Private Sub oL_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean)
Handles oL.ItemSend
Dim objPA As Microsoft.Office.Interop.Outlook.PropertyAccessor
Dim strPropSchema As String =
"http://schemas.microsoft.com/mapi/string/{2516bae8-2064-4d58-9dc3-6cdd1058f8d1}/ButtonState"
Dim strButtonState As String
objPA = Item.PropertyAccessor
'**** The following line does not work for MeetingRequests
'**** (property cannot be found)****
strButtonState = objPA.GetProperty(strPropSchema)
If strButtonState = "Pressed" Then
' Do my stuff
End If
objPA= nothing
End Sub
 
U

Upul Samaranayake

Did some more testing ..
Looks like a Meeting request starts out with the messageclass
"IPM.Appointment" but it changes to "IPM.Schedule.Meeting.Request" by the
time the Item_send event fires.
Perhaps Outlook does a conversion of some sort and Custom Properties get
"dropped" in the process? Is there a way to get them to carry over?

By the way, utilizing a User property (which do carry over) instead of a
Custom property is not a viable option for me since they happen to print on
Print-outs .. !
 
K

Ken Slovak - [MVP - Outlook]

Try using the GUID for PS_PUBLIC_STRINGS
("{00020329-0000-0000-C000-000000000046}") instead of your own custom GUID,
see if that helps.
 
U

Upul Samaranayake

Ken,
Thanks a lot for the feedback. Changing the GUID did not resolve the issue.

Here is what I found. As I had mentioned in a follow up post, when a user
schedules a Meeting (ie: an Appointment item) and clicks "send", Outlook
generates a "Meeting.request" item. In doing so, it does not transfer any
custom properties present in the Appointment item. What fires the Send event
is the Meeting Request, not the Appointment.

What I ended up doing is implement the following logic in the item_send event:
If the messageclass is a meeting.request AND
Application.ActiveInspector.CurrentItem has a messageclass of
"ipm.Appointment",
Then Look for my custom property in the ActiveInspector.CurrentItem. In all
other cases look for it in the item that fired the send event.

Tested scenarios such as accepting, forwarding the meeting.. so far so good.

Thanks again.
Upul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top