How to restrict root folder modification in the Exchange 2000 Web client (319410)



The information in this article applies to:

  • Microsoft Exchange 2000 Server

This article was previously published under Q319410

SUMMARY

Exchange 2000 Server provides a Web-based client, known as Outlook Web Access, so that e-mail users can access their mail, contacts, appointments, and other Exchange 2000 features through a Web browser.

The most common client for Exchange 2000 Server is Microsoft Outlook (any version). Outlook requires that there be specific folders in the server tree, and it does not permit the user to modify these folders. However, the Exchange Server Web client does permit users to rename, delete, or move these default folders.

If users in your organization use the Exchange Server Web client and Outlook on individual mailboxes, Microsoft recommends that you restrict these users from deleting or otherwise modifying these root folders.

MORE INFORMATION

You can easily work around this potential Outlook destabilization problem by making some simple JScript additions to the Vw_navbar20.js file in the Program files\ExchSrvr\ExchWeb\Controls folder. Paste the following functions in the bottom of the Vw_navbar20.js file.

Note This code sample is localized for both English and Spanish.
function ProhibitRootFldrMod_Hlpr( NamesArray, szURLToModify ) 
{ 
	var nIdx = -1; 
	var folderToModifyDecoded

	// Decode the folder's name that we are going to modify
	folderToModifyDecoded = szURLToModify.replace( / /g, "%20" ); 

 	while( NamesArray[ ++nIdx ] ) 
	{ 
		var szTemp = new String( g_szUserBase + NamesArray[ nIdx ] + "/" );
		var szTestURL = szTemp.replace( / /g, "%20" ); 
		delete szTemp; 
		if( szTestURL == folderToModifyDecoded ) 
		{ 
			delete folderToModifyDecoded;
			return true; 
		} 
	} 

 	return false; 
}

function ProhibitRootFldrMod()
{
	var objFolder   = objTree.selectedNode;
	var szName      = objFolder.displayname;
	var szURL       = objFolder.url;
	var szEnglishFolders = new Array();
	var nIdx = -1;
	
	szEnglishFolders[ ++nIdx ] = "Calendar"; // Calendar
	szEnglishFolders[ ++nIdx ] = "Contacts"; // Contacts
	szEnglishFolders[ ++nIdx ] = "Deleted Items";// Deleted Items
	szEnglishFolders[ ++nIdx ] = "Drafts";	// Drafts
	szEnglishFolders[ ++nIdx ] = "Inbox";	// Inbox
	szEnglishFolders[ ++nIdx ] = "Journal";	// Journal
	szEnglishFolders[ ++nIdx ] = "Notes";	// Notes
	szEnglishFolders[ ++nIdx ] = "Outbox";	// Outbox
	szEnglishFolders[ ++nIdx ] = "Sent Items";// Sent Items
	szEnglishFolders[ ++nIdx ] = "Tasks";	// Tasks
// Termination of Array with NULL value
	szEnglishFolders[ ++nIdx ] = null;

	nIdx = -1;
// Spanish Folder Names too!
	var szSpanishFolders = new Array();
	szSpanishFolders[ ++nIdx ] = "Calendario";// Calendar
	szSpanishFolders[ ++nIdx ] = "Contactos";// Contacts
	szSpanishFolders[ ++nIdx ] = "Elementos eliminados";// Deleted Items
	szSpanishFolders[ ++nIdx ] = "Elementos enviados";// Sent Items
	szSpanishFolders[ ++nIdx ] = "Bandeja de entrada";// Inbox
	szSpanishFolders[ ++nIdx ] = "Diario";// Journal
	szSpanishFolders[ ++nIdx ] = "Notas";// Notes
	szSpanishFolders[ ++nIdx ] = "Bandeja de salida";// Outbox
	szSpanishFolders[ ++nIdx ] = "Tareas";// Tasks
	szSpanishFolders[ ++nIdx ] = "Borradores";// Drafts
// Termination of Array with NULL value
	szSpanishFolders[ ++nIdx ] = null;

	var szMsg = null;
	var ret = ProhibitRootFldrMod_Hlpr( szEnglishFolders, szURL );
	if( true == ret )
	{
		szMsg = " has been restricted from modification";
	}
	else
	{
		ret = ProhibitRootFldrMod_Hlpr( szSpanishFolders, szURL );
		if( true == ret )
		{
			szMsg = " se ha restringido de la modificacion.";
		}
	}		
	if( ret == true )
		window.alert( szName + szMsg );
	delete szSpanishFolderNames;
	delete szEnglishFolders;
	return ret;
}
				
This code handles the actual process of determining whether you are dealing with a root folder.

The only other changes that you must make are in the MenuSelect function that is located near the top of the file, above the new code that you just inserted. To make these changes to the MenuSelect function, insert the two lines of code in three different positions in the function, as follows:
function MenuSelect(item)
{
	switch (item)
	{
		case "Delete": 
			var node    =   objTree.selectedNode;
			var szName  =   node.displayname;
			var szURL   =   node.url;
/* NEW CODE HERE */	if( true == ProhibitRootFldrMod())
/* NEW CODE HERE */		return;
			if(confirm(L_ConfirmDelete_Text))
			{
				objTree.deleteFolder(szURL);            
			}
		break;
		case "Rename":
/* NEW CODE HERE */	if( true == ProhibitRootFldrMod())
/* NEW CODE HERE */		return;
			DoRenameCommand();
		break;
		case "Copy":
			DoMoveCopyCommand("Copy");
		break;
		case "Move":
/* NEW CODE HERE */	if( true == ProhibitRootFldrMod())
/* NEW CODE HERE */		return;
			DoMoveCopyCommand("Move");
		break;
		case "New Folder":
			DoNewFolderCommand();
		break;
		case "Open":
			var node = objTree.selectedNode;
			if(node)
			{
				Navigate(node.url + "?Cmd=contents");       
			}
		break;
		case "OpenNewWindow":
			var node        = objTree.selectedNode;
			var szURL       = node.url + "?Cmd=contents";
			var windowName  = new String(Math.round(Math.random() * 100000));
			var hWin = window.open(szURL,windowName,"toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1")
		break;
	
	}            
	return (false);
}
				
Note that any languages that you implement in the Exchange Server Web client must be handled in the ProhibitRootFldrMod function. Also note that because you are handling this task on the client side, it is still possible for a script-savvy user to create (hack) a request to modify the folders.

The code changes demonstrated in this sample code prevent users from renaming, moving, or deleting the root folders of the mailboxes that they have access to through the Web client.

Because of the natural evolution of the Exchange Server Web client, this code may require future changes to function correctly with new software releases. In any event, make sure that you back up your original script file before you edit it.

Modification Type:MajorLast Reviewed:6/24/2005
Keywords:kbhowto kbinfo kbnofix KB319410