MAPI Office 2003 security (allow access for x minutes) scripting on web page

L

larry

(sorry for cross posting - but this seems to span several areas and I
didn't find a perect fit in any news group)

I have a form on a web page on the intranet. One field is for entering
names and is automatically resolved to global address book (GAL) names
by using MAPI to resolve - see code below.

The problem is that the organisation here is going to migrate to
Office 2003 and that means that some office 2000 dll is being replaced
by a more "secure" office 2003 dll. This new dll now pops up a box
saying "A program is trying to access e-mail addresses ..... allow
access for 1 minute" when the names entered on the web page is being
resolved ..

This behaviour is going to be very annoying for the users and we need
another solution. I tried CDO - but that seems to rely on MAPI because
the same pop up appears. I also tried
createobject("outlook.application") , but that is now SO smart that it
tries to resolve the name in the to address field on the new mail
being created - and not displaying the "check names" from Outlook.

How can I resolve names without the "security" pop-up - any ideas ?

cheers
larry p


Function MAPIResolve(strName)' As String
On Error Resume Next
Dim oSession
Dim oFolder
Dim oMessages
Dim oMessage
Dim oRecipients

Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", True, False, -1, True

Set oFolder = oSession.Inbox
Set oMessages = oFolder.Messages
Set oMessage = oMessages.Add

Set oRecipients = oMessage.Recipients.Add(strName)
oRecipients.Resolve

oMessage.Update
MAPIResolve = oMessage.Recipients(1)
Set oRecipients = Nothing
oMessage.Delete
Set oMessage = Nothing
Set oMessages = Nothing
Set oFolder = Nothing
oSession.Logoff
Set oSession = Nothing
end Function
 
K

Ken Slovak - [MVP - Outlook]

If you are supporting only Outlook 2003 things are actually easier than
before. You just take the Application object passed to you in the Outlook
VBA or in the On_Connection event of a COM addin and derive all your Outlook
objects from that and they will be trusted. CDO 1.21 is never trusted
however.

All Outlook versions since Outlook 2000 SP3 do have that security, so you're
probably going to have to deal with it anyway though.

You can use Extended MAPI, not the same thing as CDO 1.21, which is trusted
but has a steep learning curve and can only be coded in C++ or Delphi. You
can also use the Redemption library (www.dimastr.com/redemption) to avoid
the prompts. Another choice if using Exchange server is using the Exchange
security form.

For more information about the security restrictions and how to work around
them see http://www.outlookcode.com/d/sec.htm
 

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