Ich habe mal noch was geändert:
Hab damit auch gleich mal die Nutzer generft
Sub Initialize
Dim session As New notessession
Dim serverName As String
serverName = Inputbox("Bitte Server eingeben",,"Servername")
Dim directory As NotesDbDirectory
Set directory = New NotesDbDirectory(ServerName)
Dim db As NotesDatabase , db2 As notesdatabase
Dim doc As NotesDocument
Set db = directory.GetFirstDatabase( Database )
Set db = session.CurrentDatabase
Print "Agent is Running..........."
'notes: you have to open the database after you do the quota and before youset the size in order for it to work properly. 'go through every database,get the quota, open the database, get the size.
'if the database's quota isn't 0 and if the size is over the quota
'then populate the information into the lines that will go into theemailsent to the user
'populate the lines into the email
'Summary is going to be the email sent to the admins
Set Summary = New notesdocument(db)
Set SumBody = New NotesRichTextItem (Summary, "Body")
SumLine1 = "The following users are over quota and have been notified:"
SumLine2 = "UserName: Mail File Size Mail Quota"
Call SumBody.AppendText(SumLine1) 'append the line to the Summary message
Call SumBody.AddNewLine(1)
Call SumBody.AppendText(SumLine2) 'append the line to the Summary message
verzeichnis=Inputbox("Bitte Verzeichnis eingeben",,"Mail\")
Do While Not (db Is Nothing)
On Error Resume Next
ver=Lcase(db.filepath)
If Instr(ver, Lcase(verzeichnis)) > 0 Then
dbmax = 50
Call db.OpenMail 'you have to open the db to get the size property
dbsize = (db.size)/1024 'puts size into kb
dbsize = Round( (dbsize/1024), 0 ) 'puts size into mb, rounds to nearestinteger
If ( dbmax > 0) And (dbsize > dbmax)Then 'if the size is over the quota,then send them a message
Line1 = "Die Größe Ihrer MailDatei auf dem Server beträgt: " & dbsize & " Mb"
Line2 = "Ihre MailDatei sollte nicht größer als " & dbmax & " Mb sein. Bitte löschen Sie EMails auf dem Server."
Set message = New notesdocument(db) 'the message to the users
Set RTBody = New NotesRichTextItem (message, "Body")
Call RTBody.AddNewLine(1)
Call RTBody.AppendText(Line1)
Call RTBody.AddNewLine(2)
Call RTBody.AppendText(Line2)
'populate the summary line with that db's information
SumLine3 = db.Title & " " & dbsize & " " & dbmax 'update the summary information
Call SumBody.AddNewLine(3) 'add a return
Call SumBody.AppendText(SumLine3) 'add in the line
'populate the email's form and send
With message
Call .ReplaceItemValue("Form","Memo")
Call .ReplaceItemValue("SendTo", db.Title)
Call .ReplaceItemValue("Subject","Achtung Ihre MailDatei auf dem Server ist zu groß geworden!")
Call message.Send(False)
End With
End If
End If
Set db = directory.GetNextDatabase 'get the next database
Loop
'populate and send the summary information to the admins
With Summary 'send the email to the administrators
Call .ReplaceItemValue("Form","Memo")
Call .ReplaceItemValue("SendTo", "Christopher Schoeneich@Bundeswehr")
Call .ReplaceItemValue("Subject","Over Quota List")
Call Summary.Send(False)
End With
Print "Agent is finished!"
End Sub