OL2002: The CurrentView Method Does Not Work When You Use a Folder Homepage View (311353)



The information in this article applies to:

  • Microsoft Outlook 2002

This article was previously published under Q311353

SYMPTOMS

When you access or modify the CurrentView method of the Outlook Object Model (OOM) while you are in the folder homepage view in Outlook 2002, you may receive the following error message:
Internet Explorer Script Error An error has occurred in the script on this page Invalid procedure call or argument: '<VariableName>.ActiveExplorer.CurrentView'

WORKAROUND

To work around this problem, use the Outlook View Control that is installed with Outlook 2002.

Include a hidden IFRAME as the target for the navigation because the Outlook Object Model security is turned on when you navigate to a JavaScript Uniform Resource Locator (URL) in the top-level window. If the appearance of the link is not an issue, you can leave out the HREF and the IFRAME. The following code is an example of how to use the Outlook View Control:
<html>
<head>
<title>Example Page</title>

<script language="JavaScript">
var AppliOutlook = window.external.OutlookApplication;
var FolderDossiers = AppliOutlook.ActiveExplorer.CurrentFolder.Folders("Repro");

function AfficheFolderView( ReproFolder, StrView )
{
<WWBLOCKQUOTE>
var ViewCtl = document.all("viewctl");

	// Use the ActiveX view control to update the destination folder's view<BR/>
	ViewCtl.Folder = ReproFolder.FolderPath;<BR/>
	ViewCtl.View = StrView;<BR/>
	alert(ViewCtl.ActiveFolder);

	// Change to the destination folder
	AppliOutlook.ActiveExplorer.CurrentFolder = ReproFolder;
</WWBLOCKQUOTE>	
}
</script>

</head>
<body>
<iframe name="empty" style="display:none;"></iframe>
<a target="empty" href="about:blank" onclick="AfficheFolderView( FolderDossiers,'By Sender');">link to "Folder"</a>

<OBJECT CLASSID="CLSID:0006F063-0000-0000-C000-000000000046" height=0 width=0 id="viewctl"></OBJECT>
</body>
</html>
				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MajorLast Reviewed:4/17/2002
Keywords:kbbug kberrmsg KB311353