How do I get JavaScript to run in Outlook?

C

Chris Mahoney

Hi

I'm on a LAN, and all users have Outlook 2003. I'm trying to create an
email message which includes a link to open an InfoPath form. I'm
currently using the following code:

<html>
<head>
<title>InfoPath Launcher</title>
<script language="javascript" type="text/javascript">
function launchInfoPath()
{
objInfoPath = new ActiveXObject("InfoPath.Application");
strXSFPath = "D:\\Path\\manifest.xsf";
objInfoPath.XDocuments.NewFromSolution(strXSFPath);
}
</script>
</head>
<body>
Click <a href="javascript:launchInfoPath();">here</a> to open form.
</body>
</html>

That code works perfectly in IE (InfoPath opens and the form appears),
but not in Outlook. When you click the link, IE opens for a
split-second then closes itself, and InfoPath doesn't start at all.
Outlook seems to be disabling (some of?) the JavaScript, yet I can't
find any settings for it.

Does anyone have any suggestions? I've already asked in
microsoft.public.infopath but nobody could help :(

Thanks
Chris
 
S

Sue Mosher [MVP-Outlook]

That's expected behavior. For security reasons, Outlook doesn't run code in HTML messages.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

One possible solution would be to give users a URL to a web page with code behind it to launch the form. If you are working in an Exchange organization and have permission to publish to the Organizational Forms library, you could use VBScript behind a published custom Outlook message form.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Chris Mahoney

Sue said:
One possible solution would be to give users a URL to a web page with code behind it to launch the form.

Just thought of that one and came back to ask whether it would work.
Since you've already suggested it, that's probably a Yes :)
 

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