Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Contacts / August 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
larry - 24 Aug 2004 09:32 GMT
(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
Ken Slovak - [MVP - Outlook] - 24 Aug 2004 14:10 GMT
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

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> (sorry for cross posting - but this seems to span several areas and I
> didn't find a perect fit in any news group)
[quoted text clipped - 50 lines]
> Set oSession = Nothing
> end  Function

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.