Quote:
> When I execute the following code in an ASP document, I get the error
> message "ActiveX component can't create object 'Outlook.Application'".
> Outlook XP is installed on the test machine, and this code works in
>
Visual Basic just fine.
> Any ideas as to why it would fail?
You can use any COM object inside IE hosted script provided you want to deal
with the IE enforced security model regarding "unsafe ActiveX...". Whether
the user allows this is strictly up to them. There is no way to do this
silently without some prior acknowledgement and permission from the end
user...
Whether you use JScript's new ActiveXObject() or VBScript's CreateObject()
or whether you get the prompt or the failure, the issues are still the
same...
Q195826 - PRB: CreateObject Fails from Client-Side Scripts
http://support.microsoft.com/default.aspx?kbid=195826
For an Intranet, network share, or local hard drive scenario, you can simply
use HTAs instead.
Note that an HTA solution is appropriate ***only*** for non-intERnet
scenarios. End users should never be expected to execute an HTA delivered
from an intERnet source any more than expecting them to execute an EXE,
unless they have an extremely high level of trust for the originating site.
That's why accessing an HTA via IE is treated exactly like accessing an EXE.
The end user is prompted to save or open (execute) the HTA, the exact same
prompt as for as any other file type that will execute on the client.
Converting to an HTA can be as simple as saving the file with .hta instead
of .htm as the extension. .hta files are hosted by mshta.exe rather than
iexplore.exe, and have a security model comparable to a conventional Windows
desktop application. Of course accepting and executing an HTA is also up to
the end user...
Description of Internet Explorer Security Zones Registry Entries
http://support.microsoft.com/default.aspx?kbid=182569
If I need that kind of access to client resources, I develop/deploy an HTA.
Introduction to HTML Applications (HTAs)
http://msdn.microsoft.com/workshop/author/hta/overview/htaoverview.asp
HTA Reference
http://msdn.microsoft.com/workshop/author/hta/reference/hta_ref_entry...
The HTAs I deploy follow a hybrid deployment model. The HTA itself is simply
a wrapper for a trusted iframe hosting an ASP page. The iframe page doesn't
have to be asp. It could be ordinary htm, php, etc., whatever the server
supports.
With this model, it doesn't matter if the user saves/runs a local copy of
the HTA - the real content is delivered via http from a web server. To test
changes to the ASP content, I keep a local copy of the HTA with the base
href URL pointing to a development web server instead of the production
server.
You can use the same model for a network file server deployment as well.
Just change the base href to "\\YourFileServer" and iframe src to
"\YourShare\YourPath\YourPage.htm".
<html>
<head><title>YourTitle</title>
<base href="http://YourProductionServer">
<hta:application id="YourAppId"
applicationName="YourAppName"
singleInstance="yes"
showInTaskbar="yes"
borderStyle="fixed"
/>
</head>
<body scroll="no" style="margin:0px">
<iframe width="100%" height="100%"
frameborder="no" border="0"
marginheight="0" marginwidth="0"
application="yes"
src="/YourSite/YourPath/YourPage.asp"
></iframe>
</body>
</html>
--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
Windows 2000 Scripting Guide
Microsoft? Windows?2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overvie...
Script Center
http://www.microsoft.com/technet/scriptcenter/default.asp
Download details: System Administration Scripting Guide Scripts
http://www.microsoft.com/downloads/details.aspx?displaylang=en&Family...