0

I'm trying to initialize MIP in Outlook VSTO add-in, it failed with System.EntryPointNotFoundException: 'Unable to find an entry point named '?' in DLL 'mip_dotnet'.' exception on MIP.CreateMipContext method.

   MipContext mipContext = MIP.CreateMipContext(appInfo,
                             "mip_data",
                             LogLevel.Trace,
                             null,
                             null);

I wonder if there is a way to integrate MIP protection API in Outlook VSTO add-in? Thanks!

1 Answers1

1

You need to add a reference to the Microsoft.InformationProtection.dll assembly. Then you must call the MIP.Initialize method which loads the MIP dlls needed for UPE.

var subDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + (Environment.Is64BitProcess ? "x64SubFolder" : "x86SubFOlder");
  var factory = MIP.Initialize(MipComponent.Policy, subDir);
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thanks Eugene, I added the hard code path for x64 dll as there is no exist dll sub folder path under the addin assembly. It still got the same error. Is there anything I can try? Thanks a lot! ` //var subDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + (Environment.Is64BitProcess ? "x64" : "x86"); var subDir = @"C:\Users\azadm\source\repos\OutlookAddIn1\OutlookAddIn1\bin\Debug\x64"; ` – Sam Lin Jun 03 '20 at 03:53
  • Update the status. I use process monitor tool to trace the file not found error. Then I copy all the x64 dll to the respective path. I got another error. System.Runtime.InteropServices.SEHException: 'External component has thrown an exception.' – Sam Lin Jun 03 '20 at 08:59
  • See https://stackoverflow.com/questions/1313853/how-should-you-diagnose-the-error-sehexception-external-component-has-thrown-a . – Eugene Astafiev Jun 03 '20 at 14:53