Smart Tool to export mail files size to an Excel file

Dim db As NotesDatabase
	Dim mailpos As Integer
	Dim found As Integer
	Dim servername As String
	Dim mailpath As String
	Dim mailowner As String
	Dim inotesdoc As NotesDocument
	Dim view As NotesView
	Dim xlFilename As String
	Dim Excel As Variant
	Dim xlWorkbook As Variant
	Dim xlSheet As Variant
	Dim object As NotesEmbeddedObject
	Dim i As Integer
	xlFilename = "C:\dbsize.xls"
	Set Excel = CreateObject( "Excel.Application" )
	Excel.Visible = True
	Excel.Workbooks.Open xlFilename
	Set xlWorkbook = Excel.ActiveWorkbook
	Set xlSheet = xlWorkbook.ActiveSheet
	Dim cellval As String
	Dim item As NotesItem
	Dim profilecollection As NotesDocumentCollection
	Dim doc1 As NotesDocument


	'Mail subdirectory name
	mailpath = "mail\"
	'Server name (in canonical format  e.g  CN=Servername/O=Acme):
	servername = "xxxxxx/xxxx"

	Dim dbdir As New NotesDbDirectory(servername)
	'Cycle through mail databases on the server
	Set db = dbdir.GetFirstDatabase(DATABASE)
	i=1
	While Not db Is Nothing

		On Error Resume Next
		'Check to see if this database is in the mail directory
		mailpos = InStr(db.FilePath, mailpath)
		If mailpos = 1 Then
			Call db.Open(servername, db.FilePath)
			xlsheet.Cells(i,1).value=db.title
			
			xlsheet.Cells(i,2).value=db.size
			
			i=i+1
		End If
		
		Set db = dbdir.GetNextDatabase()
	Wend
	Exit Sub





Exporting mail files size of all the databases under Domino\data\mail folder to an Excel file.

Note : This agent need to be run from Admin Client with Full Access Admin enabled.

To export the mail files size to an Excel file, please create 'dbsize.xls' file and place in C drive.

Keep the Agent properties as below :

Under Runtime, Select 'Action Menu Selection' and Target as 'None'

Open the database from Admin Client and run the agent from Action menu.

LotusScript
Sudhakar K Reddy
January 4, 2017 1:02 PM
Rating
8

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



1 comment(s)Login first to comment...
Craig Fogus
(at 11:18 on 23.08.2017)
First, thanks for this code. Second, I'm getting this error on the "On Error Resume Next" Statement is illegal outside of a subprogram. Any ideas? Thanks!