Could not load file or assembly Interop.MAPI

D

Dhananjay

Hi All,
I am developing one VSTO addin for office 2007 in VB 2005. I have used
CDO. As per suggesion on MS site, I have given strong Name to my
addin. My addin is shown in the ol2007 perfectly, but when I tried to
open a custom form with clicking on my commandbar button, I am getting
the error as

"Could not load file or assembly Interop.MAPI, version = 1.21.0.0,
culture = nutral , publicKeytoken = ...... Or one of its dependancies.
Failed to grant permission to execute. ( Excception for HRESULT:
0x80131418)"

In my click event of the custom button, I have used some CDO
statements like
Try
Dim msg As MAPI.Message
Dim ses As New MAPI.Session
ses.Logon("", "", False, False)
msg = ses.GetMessage(myCurrentItem.EntryID)
If msg IsNot Nothing Then msg.Delete()
ses.Logoff()
msg = Nothing
ses = Nothing
Catch ex As System.Exception
AddTrace("Error while deleting mailitem - " & ex.Message)
End Try
Where am I wrong?

Thanks,
Dhananjay
 
D

Dhananjay

CDO 1.21 is not installed by Outlook 2007.

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool









- Show quoted text -

Thanks Dmitry for you reply,
So can't we use CDO 1.21 library from office 2003? Next, my code was
working perfectly when my project was in Shared Addin, but when I
changed the project to VSTO, I am facing those problems.
Further, I need to delete specific mail. I used above code snippet
for deleting the mail that I have currently opened. I used previously
myMail = Application.session.GetItemFromId(CurrentItem.EntryId)
for finding the currentItem, but it was giving me the value in myMail
as nothing.
So please can you tell me that how I can achieve the same effect in ol
model?

Thanks again
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top