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 / Programming Forms / August 2004

Tip: Looking for answers? Try searching our database.

Cannot logon programmatically to outlook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
letoat - 06 Aug 2004 17:12 GMT
I'm using the following code to access my outlook client from a web
application (ASP.NET)

function send (recipient, subject, msg, attach){
    var theApp = new ActiveXObject("Outlook.Application");
    var oNS = theApp.GetNameSpace("MAPI");
    //oNS.Logon(oNS.CurrentUser.Name, "MyPass", true, false);
    oNS.Logon("MyName", "MyPass", true, false);
    var oALs = oNS.AddressLists;
    var oAL = oALs.Item("Contacts");
    var oEntries = oAL.AddressEntries;
    var oEntry;       
    var text = "";
    for(var j = 1; j <= oEntries.Count; j++){
        text += oEntries.Item(j).Name() + ";";
    }
    alert(text);
    var theMailItem = theApp.CreateItem(0);
    theMailItem.BCC = "toto@example.com";
    for(var i=0; i<20; i++){
         theMailItem.BCC += ";toto" + i + "@example.com";
       }
       theMailItem.Subject = (subject);
    theMailItem.Body = (msg);
    theMailItem.Attachments.Add(attach,1);
    theMailItem.display(true);
    theMailItem.Recipients.ResolveAll();
    //theMailItem.Send;
    oNS.Logoff();
    }

My problem comes from the fact there is an outlook security popup
which is open when i execute this code. Somebody know how to remove
this alert ?
The popup contains about this message : "Allow access during : " ...
I've tried to add my AD profile into outlook profile access but that
doesn't work. (this is in : properties --> security)

Thanks for help.

If somebody try other way to access from an asp.Net application to
outlook (for example using OWA or other...) I will be very interested

In fact I want to use "mailto" protocol but the length of the bcc
input is to long to use this protocol (>2048). I know that i can use
SMTPMail but i want to access to personnal contact and i can't do that
with SMTP. This is why i try to access to outlook programmatically to
be able to  access my personnal contacts.
Sue Mosher [MVP-Outlook] - 06 Aug 2004 17:49 GMT
See http://www.outlookcode.com/d/sec.htm for your options with regard to the
security prompt. This is a perfect example of why the security prompt is a
good thing -- it looks like your application is trying to send a message to
everyone in my address book. If I'm practicing safe security, I sure don't
want that to happen unless I know a lot more about your application.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> I'm using the following code to access my outlook client from a web
> application (ASP.NET)
[quoted text clipped - 44 lines]
> with SMTP. This is why i try to access to outlook programmatically to
> be able to  access my personnal contacts.
 
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.