Microsoft Outlook Interop problem with Creating mail items
Hello,
I have written an email function in a VB.NET Winforms application that was working perfectly until my company migrated to Office 365. When an email is created, I am getting a "System.Runtime.InteropService.COMException". When I look at the properties of the mail item, a lot of properties show "Exception has been thrown by the target of an invocation" (see attached). I have read other related threads that appear to have different invocations of "CreateItem of type olMailItem" but all I have tried produce the same result. From what I have provided in the attachment does anything pop out as problematic with interop as related to office 365?
Re: Microsoft Outlook Interop problem with Creating mail items
Which version of vb.net and Visual Studio? From which version of Office did you upgrade? If you create a new Winform app with Office 365 reference, do things work as expected?
Re: Microsoft Outlook Interop problem with Creating mail items
jdelano,
Thanks for your reply... The version of of Visual Studio is Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.10.0. I am not sure how to tell what version of VB it is although Help/About indicates
Microsoft .NET Framework Version 4.8.09032
Visual Basic Tools 4.10.0-3.24265.4+91c77369a0242946f66e16a04587e2860357beef
I do not know the version of office my company was using prior to this upgrade. I can make inquiries...
To be honest, I do not know anything about an Office 365 reference. Is it something in addition to or instead of the Microsoft.Office.Interop.Outlook 16.0 reference? Is the Office 365 a COM reference?
Re: Microsoft Outlook Interop problem with Creating mail items
I see okay, I just was wondering if there was a large jump in Office versions. Office 2021 and 365 COM object is Microsoft Outlook 16.0 V9.6 - Office 2010 COM object is 14.0.
Maybe post more of the code, what is Signature defined as?
EDIT: added screenshot of some code I just put in a winform with vb.net framework 4.8 - it had no issue with that line.
Last edited by jdelano; Jul 16th, 2024 at 09:37 AM.
Re: Microsoft Outlook Interop problem with Creating mail items
ok, one big clue... Yes, my reference to interop 16 object library is indeed 9.6 but my project currently has a target .NET framework of 4.7.2 so it may be that if I change the target to 4.8 it may make a difference. I'll post results as soon as I can. Thank you!
Re: Microsoft Outlook Interop problem with Creating mail items
unfortunately that did not do the trick... same issue. It's just so weird that an instantiation of the mail item has standard properties that throw COM exceptions when retrieving their values.
https://forum.uipath.com/t/send-outl...abort/75638/17
"I had the same issue. What helped me was I got a popup from outlook saying that the application is trying to send an email on my behalf and do I want to allow it. I had a simulate click on the allow button and when I unchecked the simulate box it worked"
Just reaching for whatever could/might help.
Last edited by jdelano; Jul 18th, 2024 at 12:17 PM.