O
Ofer Lavi
Hello,
I am trying to reach the MailItem SenderName property.
Now, I know it is blocked since the email security update, and I
tested my code on a system without the property, and it went well.
However, the behavior I expected is seeing a pop-up window asking me
for permission to access the item (similar to the one I get
synchronizing my Palm handheld, but inetead I get an exception "object
reference not set to an instance of object". Not only that, but
afterwards trying to go back to the Outlook application, it crashes
with an access violation.
I checked it on VB6 and VB.net but the result is the same.
Here is my vb.net smaple code to reproduce that:
Dim m_application As Outlook.Application = New
Outlook.Application()
Dim mail_item As Outlook.MailItem =
m_application.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Items.Item(1)
' This is to check everything is OK. (I get the body msg here in
runtime)
MsgBox(mail_item.Body)
Dim ex As Exception
Try
MsgBox(mail_item.SenderName)
Catch ex
MsgBox(ex.ToString)
MsgBox(ex.StackTrace.ToString)
MsgBox(ex.InnerException.ToString)
End Try
I am using Outlook 2000 (and object reference ver 9.0) with Windows
2000.
Thanks for your help,
Ofer.
I am trying to reach the MailItem SenderName property.
Now, I know it is blocked since the email security update, and I
tested my code on a system without the property, and it went well.
However, the behavior I expected is seeing a pop-up window asking me
for permission to access the item (similar to the one I get
synchronizing my Palm handheld, but inetead I get an exception "object
reference not set to an instance of object". Not only that, but
afterwards trying to go back to the Outlook application, it crashes
with an access violation.
I checked it on VB6 and VB.net but the result is the same.
Here is my vb.net smaple code to reproduce that:
Dim m_application As Outlook.Application = New
Outlook.Application()
Dim mail_item As Outlook.MailItem =
m_application.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Items.Item(1)
' This is to check everything is OK. (I get the body msg here in
runtime)
MsgBox(mail_item.Body)
Dim ex As Exception
Try
MsgBox(mail_item.SenderName)
Catch ex
MsgBox(ex.ToString)
MsgBox(ex.StackTrace.ToString)
MsgBox(ex.InnerException.ToString)
End Try
I am using Outlook 2000 (and object reference ver 9.0) with Windows
2000.
Thanks for your help,
Ofer.