Extended Mapi

J

John Galt

Has anyone used extended MAPI to automate Outlook?
I had code that worked thru CDO but wanted to avoid the Outlook security
Patch that kept popping up a dialog box.

When I changed my code using the redemption library IU ran into problems
traversing the Folder structure.

Before the change the code below worked fine. The Id of the folder I want
is in Getfolder...
When I made the Redemption chnage that statement Gives me a Run-time
error -2147024809(80070057) [Collaboration Data
Objects -[E_INVALIDARG(80070057)]].

The code I have is:

Private Function LoadContacts()

Dim varInvCnt As Long
Dim InvSelect As Long
Dim InvSelected As String

Dim objSession As MAPI.Session
Dim objFolder As Redemption.MAPIFolder
Dim objmessages As MAPI.Messages
Dim Objfields As MAPI.Fields
Dim objmessage As MAPI.Message

Set objSession = CreateObject("MAPI.Session")
If Not objSession Is Nothing Then
strProfileName = "MS Exchange Settings"
objSession.Logon strProfileName, "", False
End If

'*** GetFolder("My Local E-Mail\Morang Cove Trading Company\MCTC
Contacts")
Set objFolder =
objSession.GetFolder("{00000000515BA5871FC8D5119923000475762650C2960000}")
 
K

Ken Slovak - [MVP - Outlook]

Redemption.MAPIFolder doesn't work like that. It's like SafeMailItem.
You have to get the folder object first and then assign the folder
object to MAPIFolder.Item. So your code should get a MAPI.Folder
object and assign that to objFolder.Item before you try to work with
objFolder.

Dmitry (the guy that wrote Redemption and OutlookSpy) uses Extended
MAPI all the time BTW and both of those applications were written
using Extended MAPI. You do know that the only languages that Extended
MAPI supports are C++ and Delphi? No variations of VB or C# or VB.NET
can be used with it.
 
J

John Galt

Is there anyway to suppress the security patch dialogs?


Ken Slovak - said:
Redemption.MAPIFolder doesn't work like that. It's like SafeMailItem.
You have to get the folder object first and then assign the folder
object to MAPIFolder.Item. So your code should get a MAPI.Folder
object and assign that to objFolder.Item before you try to work with
objFolder.

Dmitry (the guy that wrote Redemption and OutlookSpy) uses Extended
MAPI all the time BTW and both of those applications were written
using Extended MAPI. You do know that the only languages that Extended
MAPI supports are C++ and Delphi? No variations of VB or C# or VB.NET
can be used with it.




John Galt said:
Has anyone used extended MAPI to automate Outlook?
I had code that worked thru CDO but wanted to avoid the Outlook security
Patch that kept popping up a dialog box.

When I changed my code using the redemption library IU ran into problems
traversing the Folder structure.

Before the change the code below worked fine. The Id of the folder I want
is in Getfolder...
When I made the Redemption chnage that statement Gives me a Run-time
error -2147024809(80070057) [Collaboration Data
Objects -[E_INVALIDARG(80070057)]].

The code I have is:

Private Function LoadContacts()

Dim varInvCnt As Long
Dim InvSelect As Long
Dim InvSelected As String

Dim objSession As MAPI.Session
Dim objFolder As Redemption.MAPIFolder
Dim objmessages As MAPI.Messages
Dim Objfields As MAPI.Fields
Dim objmessage As MAPI.Message

Set objSession = CreateObject("MAPI.Session")
If Not objSession Is Nothing Then
strProfileName = "MS Exchange Settings"
objSession.Logon strProfileName, "", False
End If

'*** GetFolder("My Local E-Mail\Morang Cove Trading Company\MCTC
Contacts")
Set objFolder =
objSession.GetFolder("{00000000515BA5871FC8D5119923000475762650C296000
0}")
 
K

Ken Slovak - [MVP - Outlook]

By using Redemption, Extended MAPI, a trusted COM addin or the
settings in the security form if you are using Exchange. I use
Redemption so my apps are compatible whether or not Exchange is used.

In Outlook 2003 all VBA Outlook object model code and COM addin code
that derives all Outlook objects from the Application object passed in
the On_Connection event is trusted, but CDO code is never trusted.
 
I

Ian D.

I use CDO but need to get around that security pop-up as well. Can I
take your last sentence to mean you cannot use CDO in a COM addin?
 
K

Ken Slovak - [MVP - Outlook]

You can use CDO 1.21, I do all the time. It's just not trusted. So any
property or method that is restricted will fire the security prompts.
There's no way to get a CDO Session trusted. When I need to use
restricted properties or methods I use Redemption code, but the other
options you could use are what I mentioned.
 

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