Results 1 to 12 of 12

Thread: Microsoft Outlook Interop problem with Creating mail items

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2024
    Posts
    6

    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?
    Attached Files Attached Files

  2. #2
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    380

    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?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2024
    Posts
    6

    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?

  4. #4
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    380

    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.
    Attached Images Attached Images  
    Last edited by jdelano; Jul 16th, 2024 at 09:37 AM.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2024
    Posts
    6

    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!

  6. #6
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    380

    Re: Microsoft Outlook Interop problem with Creating mail items

    ah, so 4.7.2 and not 4.8 - yeah that may be the case.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2024
    Posts
    6

    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.

  8. #8
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    380

    Re: Microsoft Outlook Interop problem with Creating mail items

    Can you try to create a new project and use the same code? Just to see if anything will work?

  9. #9

    Thread Starter
    New Member
    Join Date
    Jul 2024
    Posts
    6

    Re: Microsoft Outlook Interop problem with Creating mail items

    Already did... no joy

  10. #10
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    380

    Re: Microsoft Outlook Interop problem with Creating mail items

    What is Signature defined as in your code, is it String like mine?

  11. #11

    Thread Starter
    New Member
    Join Date
    Jul 2024
    Posts
    6

    Re: Microsoft Outlook Interop problem with Creating mail items

    I'm sorry, I totally forgot to answer that question... Yes, it is...
    Dim Signature as String = ""

  12. #12
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    380

    Re: Microsoft Outlook Interop problem with Creating mail items

    Upload the new project you did just for a test, I'll try to run it here to see if it fails.

    EDIT:
    I know you said you read some other threads; these are what I could

    https://stackoverflow.com/questions/...on-aborted-0x8
    https://www.vbforums.com/showthread....ook-being-open

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width