Cannot logon programmatically to outlook

L

letoat

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 = "(e-mail address removed)";
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.
 
S

Sue Mosher [MVP-Outlook]

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.
 

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

Similar Threads


Top