Most savvy admins keep a copy of the user's ID file handy in case they lose their password, etc. This tip will let you get the properties of their mail files by stepping through each ID file. Make sure the ID files are based on the short names of the user or this won't work. It will also prompt you for a user's password if the default is not valid. This will allow you to flag those users so all IDs contain the the same password.
Sub Initialize ' Open up the name and address book of the server that the names to lookup are on Dim NAB As New NotesDatabase("servername/Domain", "names.nsf" ) Dim ACL_List As NotesACL Dim reg As New NotesRegistration Dim UserName As String Dim FoundFlag As Integer Dim IDFile As String Dim TemplateName As String Dim AttachedFilename As Variant Dim AttachedFIlename2 As String Dim FT_Indexed As String Dim MaxSize As Double Dim doc As NotesDocument Dim view As NotesView Dim FName As Variant Dim FName2 As String Dim LName As Variant Dim LName2 As String Dim MailFileName As Variant Dim MailFileName2 As String Dim Msg As String Dim Style As Integer Dim Title As String Dim Response As Integer ' Drive J is a shortcut to \\SERVER\SHARENAME Msg="This agent will check all user's mail files. It will record the name of the "+ _ "template and whether or not there is a file attached. If a file is attached " + _ "in the NAB, its name will be recorded in the output text file (" + _ "C:UserTemplateInfo.txt) along with the name of the user, the name " + _ "of the template and their user ID stored in \\SERVER\SHARENAME\NotesIDs\people." + Chr(13) + Chr(10) + _ Chr(13) + Chr(10) + "Click on OK to run the agent, Cancel to abort." ' Set the style to MB_ICONQUESTION + MB_OK - use numbers because the include %lsconst.lss is not here Style=33 Title="Check All Mail Files Confirmation" Response=Messagebox(Msg,Style,Title) If Response=2 Then Exit Sub ' Open up the output file fileNum% = Freefile() counter% = 0 Open "C:UserTemplateInfo.txt" For Output As fileNum% ' Write the header Print #fileNum%, Tab(47);"File" Print #fileNum%, Tab(10);"Name" ; Tab(30) ; "Template" ; Tab(45) ; "Attached"; Tab(55) ; "User ID" ; Tab(65); "Quota" Print #fileNum%, Tab(10);"----" ; Tab(30) ; "--------" ; Tab(45) ; "--------" ; Tab(55) ; "-------" ; Tab(65) ; "-----" Set view = NAB.GetView( "People" ) ' Go through each user and find out what their template is Set doc = view.GetFirstDocument While Not ( doc Is Nothing ) ' Get the name of their mail file MailFileName=doc.GetItemValue("MailFile") MailFileName2=MailFileName(0) ' Store their name FName=doc.GetItemValue("Firstname") FName2=FName(0) LName=doc.GetItemValue("Lastname") LName2=LName(0) ' Skip over the ones to not store ' Skip over the admins If FName2="Notes" Or LName2="Administrator" Then Goto SkipRecord ' Switch to the corresponding user ID ' Have to use a drive letter here to point to the ID files IDFile="J:\NotesIDs\" & Mid(MailFileName2,6) & ".id" ' Access their ID file with the default password of change_me UserName = reg.SwitchToID( IDFile, "defaultpassword") If MailFileName2<>"" Then ' Open up their mail file Dim db As New NotesDatabase( "servername/Domain", MailFileName2+".nsf") ' Store everything about the mail file of that user can be discovered ' Find out what its template name is TemplateName = db.DesignTemplateName ' Store the ACL Dim entry As NotesACLEntry Set ACL_List = db.ACL Set entry = ACL_List.GetFirstEntry ' The ACL can then be manipulated ' Add to the list ' Call db.GrantAccess("Sales Supervisors", ACLLEVEL_AUTHOR) ' Remove from the list ' Call db.RevokeAccess( "David Perron" ) ' The current access level of the user can also be acquired (see ' the QueryAccess property in the Help file) ' Find out if it is full text indexed FT_Indexed=db.IsFTIndexed Messagebox FT_Indexed ' Store its maximum size MaxSize=db.MaxSize Messagebox MaxSize ' Store the percent used PercentUsed=db.PercentUsed Messagebox PercentUsed ' Store the actual size of the db ActualSize=db.Size Messagebox ActualSize ' Store the quota size (returns 0 if not set) QuotaSize=db.SizeQuota ' At this point, the quota can be set if necessary ' Make sure to check its actual size first to make sure it is less than ' the quota value that is to be set or quotas will not work ' Set a 40MB quota for the database (in bytes) ' Set db.SizeQuota=40*1024*1024 ' Check for attachments in the NAB FoundFlag=0 ' See if there is an attachment in the NAB for this user Forall J In doc.Items ' See if there is a fieldname called $File If J.Name="$FILE" Then ' It exists, set the flag and exit the loop FoundFlag=1 Exit Forall End If End Forall If FoundFlag=1 Then ' Attachment found - store its name AttachedFilename=doc.GetItemValue("$File") AttachedFilename2=AttachedFilename(0) Else AttachedFilename2="None" End If ' Write the information to the file Print #fileNum%, LName2 + ", " + FName2 ; _ Tab(30) ; TemplateName ; Tab(45) ; AttachedFilename2 ; _ Tab(55); Mid(MailFileName2,6) & ".id" ; Tab(70); QuotaSize End If SkipRecord: Set doc = view.GetNextDocument( doc ) Wend ' Close the open file Close fileNum% ' Switch back to the admin ID when done IDFile="J:\NotesIDs\admin.id" UserName = reg.SwitchToID( IDFile,"adminpassword") End Sub