OpenSharedItem holds onto FileHandle

Discussion in 'Microsoft Outlook Program Addins' started by DamonR, Aug 8, 2011.

  1. DamonR

    DamonR

    Joined:
    Aug 8, 2011
    Messages:
    1
    Likes Received:
    0
    Good Day,

    Im working on a C# Addin application using the OL 2007 Interops.

    What Im seeing is that using Msg Files with Digital Signatures attached (Encrypted messages included) that I am unable to release the File handle for that message and as a result unable to delete it or use it later.

    This will however work for other files that do not have a Digital Signature or that are not encrypted. AKA the file handle will not be held.

    It appears that OpenSharedItem call is behaving differently for msgs that contain digital signatures.

    // Code Sample

    outlookItem = OutlookApplication.Session.OpenSharedItem("c:\testMsg.msg");

    System.Runtime.InteropServices.Marshal.ReleaseComObject(outlookItem);

    outlookItem = null;
    GC.Collect();
    GC.WaitForPendingFinalizers();
    GC.Collect();

    Thanks in Advance for any help!

    Cheers

    Damon
     
    DamonR, Aug 8, 2011
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andre Maas

    OpenSharedItem - Exception

    Andre Maas, Oct 10, 2007, in forum: Microsoft Outlook Program Addins
    Replies:
    2
    Views:
    849
    Andre Maas
    Oct 10, 2007
  2. SeekerOfTruths

    OpenSharedItem and .MSG files

    SeekerOfTruths, Dec 17, 2008, in forum: Microsoft Outlook Program Addins
    Replies:
    3
    Views:
    1,378
    Ken Slovak - [MVP - Outlook]
    Dec 18, 2008
Loading...

Share This Page