We are trying to develop a custom page for Outlook Today for Outlook 2000. One of the options on our custom page is to load a daily report that is saved in Word 2000 format on a network file share. The name of the file is in yyyymmdd format so it changes daily.
ISSUE1: The meta tag in the code below works and loads the Word document in the Outlook Today window. The problem is that the URL is static. Note that the window.open line in the function needs to be commented out for this to work.
ISSUE2: The function calculates the correct date, but will not open the Word document. If we change the suffix from .doc to .txt it works. Why does a Word document load with the Meta tag, but not with the Javascript function?
Is there an easier way to do what we want? Can the Meta tag call the function and use the variable fname as it's URL?
<HEAD>
<META HTTP-EQUIV="refresh" CONTENT="5; URL=\\server\share\msc_20030101.doc">
<SCRIPT LANGUAGE="javascript">
function getFName(fname)
{
RightNow = new Date();
var m = RightNow.getMonth() + 1;
var d = RightNow.getDate() - 1; // need yesterday's date
var y = RightNow.getFullYear();
var hr = RightNow.getHours();
if ( hr < 7 )
{
d = d - 1 // If before 7:00am subtract another day
}
var FullDate = y * 10000 + m * 100 + d // converts date to yyyymmdd format
var fname = "\\\\server\\share\\msc_" + FullDate + ".doc";
document.write("Loading file..." +fname+ "");
window.open(fname, "OLToday");
return fname;
}
getFName()
</SCRIPT>
ISSUE1: The meta tag in the code below works and loads the Word document in the Outlook Today window. The problem is that the URL is static. Note that the window.open line in the function needs to be commented out for this to work.
ISSUE2: The function calculates the correct date, but will not open the Word document. If we change the suffix from .doc to .txt it works. Why does a Word document load with the Meta tag, but not with the Javascript function?
Is there an easier way to do what we want? Can the Meta tag call the function and use the variable fname as it's URL?
<HEAD>
<META HTTP-EQUIV="refresh" CONTENT="5; URL=\\server\share\msc_20030101.doc">
<SCRIPT LANGUAGE="javascript">
function getFName(fname)
{
RightNow = new Date();
var m = RightNow.getMonth() + 1;
var d = RightNow.getDate() - 1; // need yesterday's date
var y = RightNow.getFullYear();
var hr = RightNow.getHours();
if ( hr < 7 )
{
d = d - 1 // If before 7:00am subtract another day
}
var FullDate = y * 10000 + m * 100 + d // converts date to yyyymmdd format
var fname = "\\\\server\\share\\msc_" + FullDate + ".doc";
document.write("Loading file..." +fname+ "");
window.open(fname, "OLToday");
return fname;
}
getFName()
</SCRIPT>