Domino 9 und frühere Versionen > Entwicklung
Script
Christopher:
Hallo Leute ich habe gestern folgenden Agenten im Web gefunden:
Dieser Agent überprüfte die Göße der MailDatein die MaxGröße kann man per Hand vorgeben wenn die MaxGröße überschritten ist bekommt der Nutzer eine Mail man selber erhält zum Schluß ein Gesammtbericht. Ich find das Script echt Super funktioniert auch alles soweit.
Bloß was ich nicht hinbekomme ist das der Agent im Verzeichnis "mail" sich die erste DB nimmt. Ich zweifle schon an mir selber.
Jayme Hansen
11 Jun 2001, Rating 3.60 (out of 5)
We have lots of users that use only a local mail file. This is so much faster for them, but a pain for them to monitor the size of their server mail file. This agent sends them a message when they are over quota on the server. We only care about the server as that is all we have to back up.
Code
Sub Initialize
Dim session As New notessession
Dim serverName As String
serverName = "lnt002/tsatest"
Dim directory As NotesDbDirectory
Set directory = New NotesDbDirectory(ServerName)
Dim db 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
you set 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 the
email sent 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
Do While Not (db Is Nothing)
On Error Resume Next
dbmax = (db.sizequota)/1024 'puts quota into Megs
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
nearest integer
If ( dbmax > 0) And (dbsize > dbmax)Then 'if the size is over the
quota, then send them a message
Line1 = "Your server mail file size: " & dbsize & " Mb"
Line2 = "Your server mail file quota: " & dbmax & " Mb"
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","Your Mail File is over Quota")
Call message.Send(False)
End With
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", "aaTSATESTadmin")
Call .ReplaceItemValue("Subject","Over Quota List")
Call Summary.Send(False)
End With
Print "Agent is finished!"
End Sub
eknori:
Wenn ich die Notes Hilfe richtig interpretiere, kannst du kein "Startverzeichnis" setzen. NotesDBDirectory setzt immer im root des Notes Data Verzeichnisses auf.
Da bleibt dir nix anderes übrig, als über eine IF-Abfrage festzustellen, ob du schon im mail Verzeichnis bist.
etwa so
Hole die erste Datenbank
If Instr(db.filepath, "mail\") > 0 Then
aha, wir sind im Mailverzeichnis, dann wollen wir mal
.....
end if
und weiter mit der nächsten DB
eknori
Christopher:
Hallo Eknori,
danke für Deine Hilfe werde es gleich mal ausprobieren. Hab da zwei Server wo ich den Nutzer´n mal solche Newlsetter senden muß ;D
Gruß
Christopher
Felix:
Hallo Christopher,
kannst du das fertige Script posten ?? ???
Felix
Christopher:
Hallo Felix,
bekommst Du gedulde Dich bitte noch etwas.
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln