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
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