Jump to content

Recommended Posts

Posted
Ok I've found a way to display folder sizes using an asp page but i was wondering if anyone know how to integrate this into OWA. If its possible i would like to add an additional option when you right click any of the folders in tree view ie if you right click in box the submenu will have an option that says 'Folder Size'. If thats not possible maybe someone could suggest a way to link OWA and my asp page together?
  • 1 year later...
Posted

The following is the script used to get and display the mailbox size but I dont know if it will work with 2007, and I thought there was already a way (inbuilt feature) to display the mailbox size in OWA 2007.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>


MailBox Size




<%
Dim strError
Dim iSize
Dim sMsg
Dim strLogon, arrLogon, strPassword
Dim arrFolders(11), arrFolderPath

strLogon = Request.ServerVariables("LOGON_USER")

if instr(strLogon,"\") <> 0 then
arrLogon = split(strLogon,"\")
strLogon = arrLogon(1)
elseif instr(strLogon,"@") <> 0 then
arrLogon = split(strLogon,"@")
strLogon = arrLogon(0)
end if

strPassword = Request.ServerVariables("AUTH_PASSWORD")

strError = MailboxSize

Function MailboxSize()
  	Dim sConnString

  	' Set up connection string to mailbox.
  	sConnString = "file://./backofficestorage/exchange.suttcold.bham.sch.uk/mbx/"	
sConnString = sConnString & strLogon

  	iSize = 0

for i = 0 to 11
	arrFolders(i) = 0
next

  	RecurseFolder(sConnString)

MailboxSize = sMsg
End Function

Public Function RecurseFolder(sConnString)
on error resume next
  	Dim oRecSet
  	Dim sSQL
Dim sConn
Dim oConn
Dim iFolderSize

  ' Set up SQL SELECT statement.
  	sSQL = "SELECT ""http://schemas.microsoft.com/mapi/proptag/x0e080003"", "
  	sSQL = sSQL & """DAV:href"", "
  	sSQL = sSQL & """DAV:hassubs"" "
  	sSQL = sSQL & "FROM SCOPE ('SHALLOW TRAVERSAL OF """ & sConnString
  	sSQL = sSQL & """') WHERE ""DAV:isfolder"" = true"

sConn = "Provider=Exoledb.DataSource.1;User ID=" & strLogon & ";Password=" & strPassword
sConn = sConn & ";Mode=Read;Data Source=" & sConnString

  	' Create RecordSet object.
  	Set oRecSet = CreateObject("ADODB.Recordset")
  	if Err.Number <> 0 then
     	sMsg = "Error creating ADO RecordSet object: " & Err.Number & " " & Err.Description
     	Exit Function
  	end if

  ' Open Recordset of all subfolders in folder.
  	oRecSet.CursorLocation = 3
oRecSet.open sSQL, sConn

if Err.Number <> 0 then
     	sMsg = "Error opening recordset: " & Err.Number & " " & Err.Description
     	oRecSet.Close
     	Set oRecSet = Nothing
     	Exit Function
  	end if

  	if oRecSet.RecordCount = 0 then
     	oRecSet.Close
     	Set oRecSet = Nothing
     	Exit Function
  	end if

  	' Move to first record.
  	oRecSet.MoveFirst
  	if Err.Number <> 0 then
     	sMsg = "Error moving to first record: " & Err.Number & " " & Err.Description
     	oRecSet.Close
     	Set oRecSet = Nothing
     	Exit Function
  	end if

  	' Loop through all of the records, and then add the size of the 
  	' subfolders to obtain the total size.
  	While oRecSet.EOF <> True
	iFolderSize = oRecSet.Fields.Item("http://schemas.microsoft.com/mapi/proptag/x0e080003")
	redim arrFolderPath(-1)
	arrFolderPath = split(oRecSet.Fields.Item("DAV:href"),"/")
     	' Increment size.
     	iSize = iSize + iFolderSize    
	
	if ubound(arrFolderPath) > 6 then
		Select Case arrFolderPath(7)	
     			Case "Inbox"
				arrFolders(0) = arrFolders(0) + iFolderSize
			Case "Outbox"
				arrFolders(1) = arrFolders(1) + iFolderSize
			Case "Sent Items"
				arrFolders(2) = arrFolders(2) + iFolderSize
			Case "Deleted Items"
				arrFolders(3) = arrFolders(3) + iFolderSize
			Case "Calendar"
				arrFolders(4) = arrFolders(4) + iFolderSize
			Case "Contacts"
				arrFolders(5) = arrFolders(5) + iFolderSize
			Case "Drafts"
				arrFolders(6) = arrFolders(6) + iFolderSize
			Case "Journal"
				arrFolders(7) = arrFolders(7) + iFolderSize
			Case "Notes"
				arrFolders(8) = arrFolders(8) + iFolderSize
			Case "Tasks"
				arrFolders(9) = arrFolders(9) + iFolderSize
			Case "Junk E-mail"
				arrFolders(10) = arrFolders(10) + iFolderSize
			Case "Sync Issues"
				arrFolders(11) = arrFolders(11) + iFolderSize
		End Select	
	end if
	' If the folder has subfolders, recursively call RecurseFolder to process them.
     	If oRecSet.Fields.Item("DAV:hassubs") = True then
   		RecurseFolder oRecSet.Fields.Item("DAV:href")
     	End If
	
     	' Move to next record.
     	oRecSet.MoveNext
     	if Err.Number <> 0 then
        	sMsg = "Error moving to next record: " & Err.Number & " " & Err.Description
        	Set oRecSet = Nothing
        	Exit Function
     	end if
  	wend

  ' Close Recordset and Connection.
  oRecSet.Close
  if Err.Number <> 0 then
     sMsg = "Error closing recordset: " & Err.Number & " " & Err.Description
     Set oRecSet = Nothing
     Exit Function
  end if

  ' Clean up memory.
  Set oRecSet = Nothing
End Function
%>
</pre><table width="407" border="0" cellpadding="0" cellspacing="0">
 
  
   Inbox:
   <%= cInt(arrFolders(0)/1024) %>
 
  
   Outbox:
   <%= cInt(arrFolders(1)/1024) %>
 
  
   Sent 
     Items:
   <%= cInt(arrFolders(2)/1024) %>
 
  
   Deleted 
     Items:
   <%= cInt(arrFolders(3)/1024) %>
 
  
   Calendar:
   <%= cInt(arrFolders(4)/1024) %>
 
  
   Contacts:
   <%= cInt(arrFolders(5)/1024) %>
 
  
   Drafts:
   <%= cInt(arrFolders(6)/1024) %>
 
  
   Journal:
   <%= cInt(arrFolders(7)/1024) %>
 
  
   Notes:
   <%= cInt(arrFolders(8)/1024) %>
 
  
   Tasks:
   <%= cInt(arrFolders(9)/1024) %>
 
  
   Junk 
     Mail:
   <%= cInt(arrFolders(10)/1024) %>
 
  
   Sync 
     Issues:
   <%= cInt(arrFolders(11)/1024) %>
 
  
   MailBox Total 
     Size:
   <%= cInt(iSize/1024) %>
 
  
   <%= strError %>
 
</table><b

  • 10 months later...
Posted

Owa 2007 does have a basic folder size but i just shows total mailbox size not individual folder size.

 

can you tell me what lines would need to be updated to work with our setup.

 

the page you are looking for is startpage.aspx it is located in the exchange server\clientAccess\Owa\forms\premium folder if you want to add a line right above the users name (where the hover shows mailbox quota) the row is approx line 130.

I just added a new row and column and a hyperlink to where you want the user directed.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...