.net working with outlook
i have such code
For Each objItem In St开发者_如何学运维artFolder.Items
MessageBox.Show("to " + objItem.To)
Next
if field to is empty(empty in letter of outlook), there is no exception but the debugger shows
objItem.To Run-time exception thrown : System.MissingMemberException - Public member 'To' on type 'ReportItem' not found.
how can i catch this? because any try to check property objItem.To will generate another exception
Not knowing exactly what you are trying to do: You could test each item's type before attempting to access a property that does not exist for a particular type (in your post the item type in question is ReportItem
).e.g.
For Each objItem In StartFolder.Items
'' I think you will need to fully qualify ReportItem with the full namespace...
if TypeOf obItem is ReportItem
MessageBox.Show("to " + objItem.To)
Next
Can you do a try...catch to specifically catch the System.MissingMemberException?
精彩评论