My colleague Stephen Griffin recently blogged about how to show or hide the Sender Contact Photo feature in Outlook. Since he only supplied the C++ version the product team asked me to supply the .NET version.
Visual Basic
Public Sub SetSenderContactPhoto(ByVal Inspector As Object, ByVal ShowSenderContactPhoto As Boolean) Dim typeInspector As Type = Inspector.GetType() Dim dispidShowSenderPhotoMemberName As String = String.Format("[DispID={0}]", _ &HF0D0) Dim args() As Object = {ShowSenderContactPhoto} Try typeInspector.InvokeMember(dispidShowSenderPhotoMemberName, _ System.Reflection.BindingFlags.InvokeMethod, _ Nothing, _ Inspector, _ args) Catch comEx As System.Runtime.InteropServices.COMException End Try End Sub
C#
void SetSenderContactPhoto(object Inspector, bool ShowSenderContactPhoto) { Type typeInspector = Inspector.GetType(); string dispidShowSenderPhotoMemberName = String.Format("[DispID={0}]", 0xF0D0); object[] args = {ShowSenderContactPhoto}; try { typeInspector.InvokeMember(dispidShowSenderPhotoMemberName, System.Reflection.BindingFlags.InvokeMethod, null, Inspector, args); } catch(System.Runtime.InteropServices.COMException comEx) { } }