Monday, April 30, 2012

Export to excel while reading the documents.


Dim session As NotesSession
Dim db As NotesDatabase
Dim vw As NotesView
Dim doc As NotesDocument
Dim n As Integer
Dim item As NotesItem
Dim y As String
Dim xlApp As Variant
Dim workbook As Variant
Dim currdb As NotesDatabase
Dim currview As NotesView
Dim currdoc As NotesDocument
Dim nam1 As NotesName
Dim nam2 As NotesName
Sub Initialize
On Error GoTo ErrorHandler

Set session = New NotesSession
Set currdb=session.Currentdatabase
Set currview=currdb.Getview("ProfileView")
Set currdoc=currview.Getfirstdocument()
If Not currdoc Is Nothing Then
Set db=session.getdatabase(currdoc.servername(0),currdoc.filename(0))
Set vw=db.getview("vaDate")
Set xlApp =CreateObject("Excel.Application")
Set workbook=xlApp.Workbooks
workbook.Add
xlApp.Visible=True
xlApp.cells(1,1).value="header1"
xlApp.cells(1,2).value="header2"
xlApp.cells(1,3).value="header3"
xlApp.cells(1,4).value="header4"
xlApp.cells(1,5).value="header5"

n=2
Set doc=vw.getfirstdocument()
While Not doc Is Nothing
%REM


Set nam1=session.Createname(doc.FullName(0))
Set nam2=session.Createname(doc.MailServer(0))
xlApp.cells(n,1).value=nam1.Abbreviated
xlApp.cells(n,2).value=doc.Description(0)
xlApp.cells(n,3).value=doc.InternetAddress(0)
xlApp.cells(n,4).value=doc.MailDomain(0)
xlApp.cells(n,5).value=nam2.Abbreviated
%END REM
xlApp.cells(n,1).value=doc.ReportTable(0)
Set doc=vw.getnextdocument(doc)
n=n+1
Exit sub
Wend
End If
ErrorHandler:
Print "Error :" & Error$ & " on line:" & CStr(Erl)
Exit Sub
End Sub 

Retriving the ACL Entry Information for each access level for the mail db


Dim levelConstant As Integer

    Dim curDB As NotesDatabase
    Dim profilevw As NotesView
    Dim profiledoc As NotesDocument
    Dim personDB As NotesDatabase
    Dim persondoc As NotesDocument
    Dim caldoc As NotesDocument
   
    Dim LogDoc As NotesDocument
    Dim ActivityLogRTItem As NotesRichTextItem
Sub Initialize
On Error GoTo ErrorHandler
    Dim session As New NotesSession   
    Dim m As Integer
    Dim d As Integer
    Dim e As Integer
    Dim a As Integer
    Dim r As Integer
    Dim w As Integer
    Dim n As Integer
   
    e=1
    m=1
    d=1
    a=1
    r=1
    w=1
    n=1
   
    ReDim editor(1)
    ReDim manager(1)
    ReDim designer(1)
    ReDim author(1)
    ReDim reader(1)
    ReDim depositor(1)
    ReDim noaccess(1)
   
    Set curDB=session.Currentdatabase
   
    Set LogDoc=curDB.CreateDocument
    LogDoc.Form="LogForm"   
    LogDoc.Server=curdb.Server
    LogDoc.StartTime=Now
    Set ActivityLogRTItem = New NotesRichTextItem( LogDoc, "Rtxtlogactivity" )
    Call ActivityLogRTItem.AppendText( Now+ ": "&"Agent Started")
    Call ActivityLogRTItem.AddNewLine( 1)
   
    Set profilevw=curDB.Getview("Profile")
    Set profiledoc=profilevw.Getfirstdocument()
   
    While Not profiledoc Is Nothing
        Set personDB=session.Getdatabase(profiledoc.mailserver(0), profiledoc.folder(0)+"\"+profiledoc.mailfile(0))
        Set caldoc=personDB.GetProfileDocument("CalendarProfile")
       
        Set persondoc = curDB.CreateDocument
        persondoc.Form="PersonInfo"
        persondoc.txt_mailfile=profiledoc.folder(0)+"\"+profiledoc.mailfile(0)
        persondoc.txt_mailowner=caldoc.Owner(0)
       
        'ACL
        Dim Acl As NotesACL
        Dim Aclentry As NotesACLEntry
        Set Acl=personDB.Acl
        Set Aclentry=Acl.Getfirstentry()
       
        While Not Aclentry Is Nothing
           
            If (Aclentry.Level = ACLLEVEL_MANAGER) Then
                manager(m-1)=Aclentry.Name
                m=m+1
                ReDim Preserve manager(m)
                persondoc.txt_manager=manager
               
               
               
            ElseIf (Aclentry.Level = ACLLEVEL_DESIGNER) Then
                designer(d-1)=Aclentry.Name
                d=d+1
                ReDim Preserve designer(d)
                persondoc.txt_designer=designer
               
            ElseIf ((Aclentry.Level = ACLLEVEL_EDITOR))Then
                editor(e-1)=Aclentry.Name
                e=e+1
                ReDim Preserve editor(e)
                persondoc.txt_editor=editor
            ElseIf ((Aclentry.Level = ACLLEVEL_AUTHOR))Then   
                author(a-1)=Aclentry.Name
                a=a+1
                ReDim Preserve author(a)
                persondoc.txt_author=author
               
            ElseIf ((Aclentry.Level = ACLLEVEL_READER))Then
                reader(r-1)=Aclentry.Name
                r=r+1
                ReDim Preserve reader(r)
                persondoc.txt_reader=reader
               
               
            ElseIf ((Aclentry.Level = ACLLEVEL_DEPOSITOR))Then
                depositor(w-1)=Aclentry.Name
                w=w+1
                ReDim Preserve depositor(w)
                persondoc.txt_depositor=depositor
               
               
            ElseIf ((Aclentry.Level = ACLLEVEL_NOACCESS))Then
                noaccess(n-1)=Aclentry.Name
                n=n+1
                ReDim Preserve noaccess(n)
                persondoc.txt_noaccess=noaccess
                           
            End If
           
            Set Aclentry = acl.GetNextEntry( Aclentry )
           
           
        Wend
        Call persondoc.Save(True,False)   
        profiledoc.flag="Yes"
        Call profiledoc.Save(True,False)
       
        Call ActivityLogRTItem.AppendText( Now+ ": "&  "  Mail information retrived from :" & profiledoc.mailfile(0) )
        Call ActivityLogRTItem.AddNewLine( 1)
        Call ActivityLogRTItem.AppendText( Now+ ": "&"Agent Ended")
        Call ActivityLogRTItem.AddNewLine( 1)
        Call LogDoc.Save(True,False)
        Dim temp As NotesDocument
        Set temp=profiledoc
        Call profilevw.Refresh()
       
        Set profiledoc=profilevw.Getfirstdocument()
        ReDim editor(1)
        ReDim manager(1)
        ReDim designer(1)
        ReDim author(1)
        ReDim reader(1)
        ReDim depositor(1)
        ReDim noaccess(1)
        e=1
        m=1
        d=1
        a=1
        r=1
        w=1
        n=1
       
    Wend
    Exit Sub
   
    MsgBox "Completed"
   
   
   
ErrorHandler:
    Call ActivityLogRTItem.AppendText( Now+ ": "&" Error in  :" +profiledoc.mailfile(0))
    Call ActivityLogRTItem.AppendText( Now+ ": Error " & Err() & ": " & Error() & "error line:" & CStr(Erl()))
    Call ActivityLogRTItem.AddNewLine( 1)
    Call LogDoc.Save(True,False)
    Resume Next
    'Exit sub
End Sub

Sunday, April 29, 2012

Export the view data to notepad

Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim vw As NotesView
    Dim doc As NotesDocument
    Dim fileNum As Integer
    Dim fileName As String
    Dim fname As String
    Dim lname As String
    Set db=session.Getdatabase("jasmine06/SRVR/polarisFT","names.nsf")
    Set vw=db.Getview("($VIMPeople)")
    Set doc=vw.Getfirstdocument()
    fileNum% = FreeFile()
    fileName$ = "C:\Program Files\IBM\Lotus\Notes\Data\userlist.txt"    'mention the file path
    Open fileName$ For Output As fileNum%
    While  Not doc Is Nothing
        fname=doc.FirstName(0)
        lname=doc.LastName(0)
        Write #fileNum%, "CN=" & fname + "," + "OU="+lname +"," + "DC=polaris,DC=co,DC=in"
        Write #fileNum%
       
        Set doc=vw.Getnextdocument(doc)
       
    Wend
    Close fileNum%
   

Get the DB control from the Server Folders

  Dim dbdir As New NotesDbDirectory(pdoc.pab_server(0))
    Dim db As NotesDatabase
    Set db=dbdir.Getfirstdatabase(DATABASE)
   
    Do Until DB Is Nothing
        Dim item As NotesItem
        Set item=pdoc.Getfirstitem("strFolder")
       
        ForAll x In item.Values

            If Left(db.FilePath,Len(x))= x Then
                Dim tempdb As NotesDatabase
                Set tempdb=session.Getdatabase(pdoc.pab_server(0),db.FilePath)

Break the Log Document if it exceeds the minimum size

If LogDoc.Size>40000 Then
                LogDoc.FinishTime=Now   
                Call LogDoc.Save(True,False)       
                Set LogDoc=curdb.CreateDocument
                LogDoc.Form="LogForm"   
                Set ActivityLogRTItem = New NotesRichTextItem( LogDoc, "Rtxtlogactivity" )
                LogDoc.StartTime=Now   
            End If

Export the data from view to ms excell

%REM
    Agent export
    Created Feb 8, 2012 by vijayasree/dev1
    Description: Comments for Agent
%END REM
Option Public
Option Declare

Sub Initialize
    Dim session As New NotesSession
    Dim wks As New NotesUIWorkspace
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim uiView As NotesUIView
    Dim doc As NotesDocument
    Dim column As NotesViewColumn

    Dim row As Long,colcounter As Long,arrcnt As Long,arrcounter As Long, x As Long
    Dim filename As String, currentvalue As String
    Dim rowsatonce As Integer,cn As Integer
    Dim xlApp As Variant, xlsheet As Variant,xlwb As Variant, xlrange As Variant, tempval As Variant
    Dim DataArray
    Dim VColumns List As String

    ReDim DataArray(0, 80) As String
    '80 columns is our expected max number of columns in the view. It's dynamically recomputed below to actual (lower) number. Change if the number of columns is larger.

    Set db=session.CurrentDatabase
    Set xlApp = CreateObject("Excel.Application")

    xlApp.Visible = True 'Excel program is visible (to avoid errors and see what is happening)

    Set xlwb=xlApp.Workbooks.Add
    Set xlsheet =xlwb.Worksheets(1)

    Set uiView = wks.CurrentView
    Set view = db.GetView( uiView.ViewName ) ' get the view currently open in UI
    arrcnt=0
    row=1
    colcounter=0
    rowsatonce=20
    ForAll c In view.Columns
        If c.isIcon<>True Then ' do not include icon columns
            If c.Formula<>"""1""" And c.Formula<>"1" Then 'do not include columns which are used for counting docs (Total)
                colcounter=colcounter+1
                DataArray(row-1, colcounter-1) =c.Title
                VColumns(CStr(cn))=CStr(cn)
            End If
        End If
        cn=cn+1
    End ForAll
    ReDim Preserve DataArray(0, colcounter-1) As String
    xlsheet.Range("A1").Resize(1, colcounter).Value = DataArray ' set column names
    ReDim DataArray(rowsatonce-1, colcounter-1) As String
    row=2
    x=0
    Set doc = view.GetFirstDocument
    While Not ( doc Is Nothing )
        ForAll col In VColumns
            currentvalue=""
            tempval= doc.ColumnValues(Val(col))
            If IsArray(tempval) Then
                ForAll v In tempval
                    If currentvalue="" Then
                        currentvalue=v
                    Else
                        currentvalue=currentvalue+","+v
                    End If
                End ForAll
            Else
                currentvalue=tempval
            End If
            x=x+1
            DataArray(arrcounter, x-1) =currentvalue
        End ForAll
        x=0
        row=row+1
        arrcounter=arrcounter+1
        If arrcounter/rowsatonce=arrcounter\rowsatonce And arrcounter<>0 Then
            xlsheet.Range("A"+Cstr(arrcnt*rowsatonce+2)).Resize(rowsatonce, colcounter).Value = DataArray
            arrcnt=arrcnt+1
            arrcounter=0
            ReDim DataArray(rowsatonce-1, colcounter-1) As String
        End If
        Set doc = view.GetNextDocument (doc)
    Wend

    If arrcounter/rowsatonce<>arrcounter\rowsatonce And arrcounter>0 Then
        ' Redim Preserve DataArray(arrcounter, colcounter-1) As String
        xlsheet.Range("A"+Cstr(arrcnt*rowsatonce+2)).Resize(arrcounter, colcounter).Value = DataArray
    End If
    MsgBox "Done"
End Sub

Updating the ACL to the existing databases in the server

Sub Initialize
    Dim session As new NotesSession
    Dim curdb As NotesDatabase
    Dim prfvw As NotesView
    Dim pdoc As NotesDocument
    Dim entryvw As NotesView
    Dim entrydoc As NotesDocument
   
    Dim filedb As NotesDatabase
    Dim acl As NotesACL
    Dim aclentry1 As NotesACLEntry
    Dim aclentry2 As NotesACLEntry
    Dim aclentry3 As NotesACLEntry
   
    Set curdb=session.Currentdatabase
    Set prfvw = curdb.Getview("Profile")
    Set pdoc=prfvw.Getfirstdocument()
   

    Dim dbdir As New NotesDbDirectory(pdoc.pab_server(0))
    Dim db As NotesDatabase
    Set db=dbdir.Getfirstdatabase(DATABASE)
   
    Do Until DB Is Nothing
        Dim item As NotesItem
        Set item=pdoc.Getfirstitem("strFolder")
       
        ForAll x In item.Values

            If Left(db.FilePath,Len(x))= x Then
                Dim tempdb As NotesDatabase
                Set tempdb=session.Getdatabase(pdoc.pab_server(0),db.FilePath)
                Set acl =tempdb.Acl
               
                Set entryvw=curdb.Getview("ACLEntry")
                Set entrydoc=entryvw.Getfirstdocument()
               
               
                Set aclentry1=acl.Getentry(entrydoc.o_grp1(0))
                If Not aclentry1 Is Nothing Then
                    aclentry1.Name=entrydoc.n_grp1(0)
                    Call acl.Save()
                End If
               
                Set aclentry2=acl.Getentry(entrydoc.o_grp2(0))
                If Not aclentry2 Is Nothing Then
                    aclentry2.Name=entrydoc.n_grp2(0)
                    Call acl.Save()
                End If
               
                Set aclentry3=acl.Getentry(entrydoc.o_grp3(0))
                If Not aclentry3 Is Nothing Then
                    aclentry3.Name=entrydoc.n_grp3(0)
                    Call acl.Save()
                End If
               
            End If
           
        End ForAll
       
        Set db=dbdir.Getnextdatabase()
    Loop
   
   
End Sub

Import the data from ms excell to lotus notes view

%REM
    Agent Import
    Created Apr 3, 2012 by Roopesh Padoli/IT/polarisFT
    Description: Comments for Agent
%END REM
Option Public
Option Declare

Sub Initialize
   
   
    Dim session As New NotesSession
    Dim uiws As New NotesUIWorkspace
    Dim form As NotesForm
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim item As NotesItem
    Dim row As Integer
   
    Dim xlFilename As String
    Dim xlsApp As Variant
    Dim xlsWorkBook As Variant
    Dim xlsSheet As Variant
    Dim rows As Long
    Dim cols As Integer
    Dim x As Integer
    Dim itemName As String
    Dim flag As Integer
    Dim formAlias As String
    Dim sortEval As String
    Dim sortedList As Variant
    Dim indexLo As Long
    Dim indexHi As Long
    Dim fn As Variant
    Dim i As Variant
    Dim msg As Variant
    Set db = session.CurrentDatabase
   
   
    fn =uiws.OpenFileDialog(False,"Select the Excel File to Import", "c:My Documents")
    xlFilename = CStr(fn(0))
    Set form= db.GetForm("InputPrf")
   
    Print "Connecting to Excel..."
   
    Set xlsApp = CreateObject("Excel.Application")
   
    Print "Opening the file : " & xlfilename
    xlsApp.Workbooks.Open xlfilename
    Set xlsWorkBook = xlsApp.ActiveWorkbook
    Set xlsSheet = xlsWorkBook.ActiveSheet
    xlsApp.Visible = False
    xlsSheet.Cells.SpecialCells(11).Activate
    rows = xlsApp.ActiveWindow.ActiveCell.Row
    cols = xlsApp.ActiveWindow.ActiveCell.Column
   
    row = 0
    Print "Starting import from Excel file..."
    Do While True
        row = row + 1
        If row= rows+1 Then GoTo Done
        If row=1 Then
            For i=1 To cols
                ReDim Preserve fd(i)
                fd(i)=xlsSheet.Cells( row, i ).Value
                flag=0
               
                ForAll f In form.Fields
                    If LCase(fd(i)) = LCase(f) Then flag=1
                End ForAll
               
                If flag=1 Then
                    GoTo Skip
                End If
                If Not flag=1 Then
                    msg="The field name "& fd(i) &" does not appear In the form you have chosen.Exiting import."
                    MsgBox msg
                   
                End If
Skip:
            Next
        End If
       
        If Not row = 1 Then
           
           
            Set doc = db.CreateDocument
            doc.Form = "InputPrf"
           
            For i= 1 To cols
                Set item = doc.ReplaceItemValue( fd(i),        xlsSheet.Cells( row, i ).Value )
            Next
           
           
            Call doc.Save( True, True )
           
        End If      
        Print "Processing document number "& CStr(row) & " of " & CStr(rows)
 
    Loop
Done:
   
    Print "Disconnecting from Excel..."
    xlsWorkbook.Close False
    xlsApp.Quit
    Set xlsApp = Nothing
    Print " "
   
End Sub

MailFile Creation

%REM
    Agent PersonDoc
    Created Apr 25, 2012 by Vijayasree Lakkala/IT/polarisFT
    Description: Comments for Agent
%END REM
Option Public
Option Declare

Sub Initialize
    Dim session As new NotesSession
    Dim curdb As NotesDatabase
    Dim inputvw As NotesView
    Dim inputdoc As NotesDocument
    Dim user As String
    Dim staffid As String
    Dim personDb As NotesDatabase
    Dim template As New NotesDatabase( "","mail85.ntf" )
    Dim acl As NotesACL
    Dim aclentry As NotesACLEntry
   
    Dim replica As NotesDatabase
    Dim cluster As NotesDatabase
   
    Dim LogDoc As NotesDocument
    Dim ActivityLogRTItem As NotesRichTextItem
    Dim n
    n=0
    Set curdb=session.Currentdatabase
    Set LogDoc=curdb.CreateDocument
    LogDoc.Form="LogForm"   
    LogDoc.Server=curdb.Server
    LogDoc.StartTime=Now
    Set ActivityLogRTItem = New NotesRichTextItem( LogDoc, "Rtxtlogactivity" )
    Call ActivityLogRTItem.AppendText( Now+ ": "&"Agent Started")
    Call ActivityLogRTItem.AddNewLine( 1)
   
    Set inputvw=curdb.Getview("InputPrf")
    Set inputdoc=inputvw.Getfirstdocument()
   
    While not inputdoc Is Nothing
        Dim temp As NotesDocument
        Set temp=inputvw.Getnextdocument(inputdoc)
           
    'Create in homeserver
        Dim tempuser As String
        tempuser=inputdoc.username(0)
        user=StrLeft(tempuser,"/")
        staffid=inputdoc.staffid(0)
        Set personDb = template.CreateFromTemplate(inputdoc.homeserver(0),"mail\"+Trim(staffid)+".nsf", True )
        personDb.Title = user
       
        Dim caldoc As NotesDocument
        Set caldoc=personDb.Getprofiledocument("CalendarProfile")
        caldoc.Owner=tempuser
        Call caldoc.Save(True,False)
       
        Set acl=personDb.Acl
        Set aclentry=acl.Createaclentry(tempuser, ACLLEVEL_Editor)
        aclentry.Name=tempuser
        aclentry.Usertype=ACLTYPE_PERSON
        aclentry.Cancreatepersonalfolder=True
        aclentry.Cancreatesharedfolder=True
        Call acl.Save()
       
        Call ActivityLogRTItem.AppendText( Now+ ": "&  "  Mail File"+Trim(staffid)+".nsf Created in  :" + inputdoc.homeserver(0))
        Call ActivityLogRTItem.AddNewLine( 1)
   
    'Create replica copy
   
        Set replica = personDb.createreplica (inputdoc.replicaserver(0),"mail\"+Trim(staffid)+".nsf")
        replica.Title=user
       
        Dim rcaldoc As NotesDocument
        Set rcaldoc=replica.Getprofiledocument("CalendarProfile")
        rcaldoc.Owner=tempuser
        Call rcaldoc.Save(True,False)
       
        Call ActivityLogRTItem.AppendText( Now+ ": "&  "  Mail File"+Trim(staffid)+".nsf Created in  :" + inputdoc.replicaserver(0))
        Call ActivityLogRTItem.AddNewLine( 1)
   
    'Create Cluster copy
   
    %REM

        Set cluster=personDb.createreplica (inputdoc.drserver(0),"mail\"+Trim(staffid)+".nsf")
        cluster.Title=user
       
        Dim ccaldoc As NotesDocument
        Set ccaldoc=cluster.Getprofiledocument("CalendarProfile")
        ccaldoc.Owner=tempuser
        Call ccaldoc.Save(True,False)
       
        Call ActivityLogRTItem.AppendText( Now+ ": "&  "  Mail File"+Trim(staffid)+".nsf Created in  :" + inputdoc.drserver(0))
        Call ActivityLogRTItem.AddNewLine( 1)
    %END REM
        inputdoc.flag="Yes"
        Call inputdoc.Save(True,True)
       
        n=n+1
        Set inputdoc=temp
       
    Wend
   
    'set flag
   
   
    Print "Number of Mail Files creation completed " & n

    Call ActivityLogRTItem.AppendText( Now+ ": "&"Number Of User Creation:  "& n)
    Call ActivityLogRTItem.AddNewLine( 1)
    Call ActivityLogRTItem.AppendText( Now+ ": "&"Agent Ended")
    Call ActivityLogRTItem.AddNewLine( 1)
    Call LogDoc.Save(True,False)
   
End Sub

Monday, April 9, 2012

ACL Extraction thru lotus script

Sub Initialize
On Error GoTo ErrorHandler
    Dim session As New NotesSession   
   
    Set curDB=session.Currentdatabase
   
    Set LogDoc=curDB.CreateDocument
    LogDoc.Form="LogForm"   
    LogDoc.Server=curdb.Server
    LogDoc.StartTime=Now
    Set ActivityLogRTItem = New NotesRichTextItem( LogDoc, "Rtxtlogactivity" )
    Call ActivityLogRTItem.AppendText( Now+ ": "&"Agent Started")
    Call ActivityLogRTItem.AddNewLine( 1)
   
    Set profilevw=curDB.Getview("Profile")
    Set profiledoc=profilevw.Getfirstdocument()
    n=1
    While Not profiledoc Is Nothing
        Set personDB=session.Getdatabase(profiledoc.mailserver(0), profiledoc.folder(0)+"\"+profiledoc.mailfile(0))
        Set caldoc=personDB.GetProfileDocument("CalendarProfile")
        Set persondoc = curDB.CreateDocument
       
        persondoc.Form="PersonInfo"
        persondoc.txt_mailfile=profiledoc.folder(0)+"\"+profiledoc.mailfile(0)
        persondoc.txt_mailowner=caldoc.Owner(0)
       
        'ACL
        Dim Acl As NotesACL
        Dim Aclentry As NotesACLEntry
        Set Acl=personDB.Acl
        Set Aclentry=Acl.Getfirstentry()
        Dim ctr As Long
        Dim ctr1 As Long
        Dim ctr2 As Long
        Dim ctr3 As Long
        Dim ctr4 As Long
        Dim ctr5 As Long
        Dim ctr6 As Long
       
        ctr=0
        ctr1=0
        ctr2=0
        ctr3=0
        ctr4=0
        ctr5=0
        ctr6=0
       
       
        Dim acleditor As Variant
        ReDim acleditor(0)
       
        Dim aclmanager As Variant
        ReDim aclmanager(0)
       
        Dim acldesigner As Variant
        ReDim acldesigner(0)
       
        Dim aclauthor As Variant
        ReDim aclauthor(0)
       
        Dim aclreader As Variant
        ReDim aclreader(0)
       
        Dim acldepositor As Variant
        ReDim acldepositor(0)
       
        Dim aclnoaccess As Variant
        ReDim aclnoaccess(0)
       
        While Not Aclentry Is Nothing
           
           
            If (Aclentry.Level = ACLLEVEL_EDITOR) Then
                If (ctr<>0) Then
                    ReDim Preserve acleditor(UBound (acleditor)+1)
                End If
                acleditor(ctr)=Aclentry.name
                ctr=ctr+1
            ElseIf (Aclentry.Level = ACLLEVEL_MANAGER) Then
                If (ctr1<>0) Then
                    ReDim Preserve aclmanager(UBound (aclmanager)+1)
                End If
                aclmanager(ctr1)=Aclentry.name
                ctr1=ctr1+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_DESIGNER) Then
                If (ctr2<>0) Then
                    ReDim Preserve acldesigner(UBound (acldesigner)+1)
                End If
                acldesigner(ctr2)=Aclentry.name
                ctr2=ctr2+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_AUTHOR) Then
                If (ctr3<>0) Then
                    ReDim Preserve aclauthor(UBound (aclauthor)+1)
                End If
                aclauthor(ctr3)=Aclentry.name
                ctr3=ctr3+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_READER) Then
                If (ctr4<>0) Then
                    ReDim Preserve aclreader(UBound (aclreader)+1)
                End If
                aclreader(ctr4)=Aclentry.name
                ctr4=ctr4+1
               
               
            ElseIf (Aclentry.Level = ACLLEVEL_DEPOSITOR) Then
                If (ctr5<>0) Then
                    ReDim Preserve acldepositor(UBound (acldepositor)+1)
                End If
                acldepositor(ctr5)=Aclentry.name
                ctr5=ctr5+1
               
               
            ElseIf (Aclentry.Level = ACLLEVEL_NOACCESS) Then
                If (ctr6<>0) Then
                    ReDim Preserve aclnoaccess(UBound (aclnoaccess)+1)
                End If
                aclnoaccess(ctr6)=Aclentry.name
                ctr6=ctr6+1

            End If
           
           

            Set Aclentry = acl.GetNextEntry( Aclentry )
           
        Wend
       
        persondoc.txt_manager=aclmanager
        persondoc.txt_designer=acldesigner
        persondoc.txt_editor=acleditor
        persondoc.txt_author=aclauthor
        persondoc.txt_reader=aclreader
        persondoc.txt_depositor=acldepositor
        persondoc.txt_noaccess=aclnoaccess
       
        Call persondoc.Save(True,False)   
        Print "count :" & n    & "for :" & profiledoc.mailfile(0)
        Set profiledoc=profilevw.Getnextdocument(profiledoc)
        n=n+1
    Wend
   
    Dim vc As NotesViewEntryCollection
    Set vc=profilevw.Allentries
    Call vc.Stampall("flag","Yes")
    MsgBox "Completed"
   
    Exit Sub
   
ErrorHandler:
    Call ActivityLogRTItem.AppendText( Now+ ": "&" Error in  :" +profiledoc.mailfile(0))
    Call ActivityLogRTItem.AppendText( Now+ ": Error " & Err() & ": " & Error() & "error line:" & CStr(Erl()))
    Call ActivityLogRTItem.AddNewLine( 1)
    Call LogDoc.Save(True,False)
    Resume Next
    'Exit sub
End Sub

ACL Extraction thru lotus script

Sub Initialize
On Error GoTo ErrorHandler
    Dim session As New NotesSession   
   
    Set curDB=session.Currentdatabase
   
    Set LogDoc=curDB.CreateDocument
    LogDoc.Form="LogForm"   
    LogDoc.Server=curdb.Server
    LogDoc.StartTime=Now
    Set ActivityLogRTItem = New NotesRichTextItem( LogDoc, "Rtxtlogactivity" )
    Call ActivityLogRTItem.AppendText( Now+ ": "&"Agent Started")
    Call ActivityLogRTItem.AddNewLine( 1)
   
    Set profilevw=curDB.Getview("Profile")
    Set profiledoc=profilevw.Getfirstdocument()
    n=1
    While Not profiledoc Is Nothing
        Set personDB=session.Getdatabase(profiledoc.mailserver(0), profiledoc.folder(0)+"\"+profiledoc.mailfile(0))
        Set caldoc=personDB.GetProfileDocument("CalendarProfile")
        Set persondoc = curDB.CreateDocument
       
        persondoc.Form="PersonInfo"
        persondoc.txt_mailfile=profiledoc.folder(0)+"\"+profiledoc.mailfile(0)
        persondoc.txt_mailowner=caldoc.Owner(0)
       
        'ACL
        Dim Acl As NotesACL
        Dim Aclentry As NotesACLEntry
        Set Acl=personDB.Acl
        Set Aclentry=Acl.Getfirstentry()
        Dim ctr As Long
        Dim ctr1 As Long
        Dim ctr2 As Long
        Dim ctr3 As Long
        Dim ctr4 As Long
        Dim ctr5 As Long
        Dim ctr6 As Long
       
        ctr=0
        ctr1=0
        ctr2=0
        ctr3=0
        ctr4=0
        ctr5=0
        ctr6=0
       
       
        Dim acleditor As Variant
        ReDim acleditor(0)
       
        Dim aclmanager As Variant
        ReDim aclmanager(0)
       
        Dim acldesigner As Variant
        ReDim acldesigner(0)
       
        Dim aclauthor As Variant
        ReDim aclauthor(0)
       
        Dim aclreader As Variant
        ReDim aclreader(0)
       
        Dim acldepositor As Variant
        ReDim acldepositor(0)
       
        Dim aclnoaccess As Variant
        ReDim aclnoaccess(0)
       
        While Not Aclentry Is Nothing
           
           
            If (Aclentry.Level = ACLLEVEL_EDITOR) Then
                If (ctr<>0) Then
                    ReDim Preserve acleditor(UBound (acleditor)+1)
                End If
                acleditor(ctr)=Aclentry.name
                ctr=ctr+1
            ElseIf (Aclentry.Level = ACLLEVEL_MANAGER) Then
                If (ctr1<>0) Then
                    ReDim Preserve aclmanager(UBound (aclmanager)+1)
                End If
                aclmanager(ctr1)=Aclentry.name
                ctr1=ctr1+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_DESIGNER) Then
                If (ctr2<>0) Then
                    ReDim Preserve acldesigner(UBound (acldesigner)+1)
                End If
                acldesigner(ctr2)=Aclentry.name
                ctr2=ctr2+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_AUTHOR) Then
                If (ctr3<>0) Then
                    ReDim Preserve aclauthor(UBound (aclauthor)+1)
                End If
                aclauthor(ctr3)=Aclentry.name
                ctr3=ctr3+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_READER) Then
                If (ctr4<>0) Then
                    ReDim Preserve aclreader(UBound (aclreader)+1)
                End If
                aclreader(ctr4)=Aclentry.name
                ctr4=ctr4+1
               
               
            ElseIf (Aclentry.Level = ACLLEVEL_DEPOSITOR) Then
                If (ctr5<>0) Then
                    ReDim Preserve acldepositor(UBound (acldepositor)+1)
                End If
                acldepositor(ctr5)=Aclentry.name
                ctr5=ctr5+1
               
               
            ElseIf (Aclentry.Level = ACLLEVEL_NOACCESS) Then
                If (ctr6<>0) Then
                    ReDim Preserve aclnoaccess(UBound (aclnoaccess)+1)
                End If
                aclnoaccess(ctr6)=Aclentry.name
                ctr6=ctr6+1

            End If
           
           

            Set Aclentry = acl.GetNextEntry( Aclentry )
           
        Wend
       
        persondoc.txt_manager=aclmanager
        persondoc.txt_designer=acldesigner
        persondoc.txt_editor=acleditor
        persondoc.txt_author=aclauthor
        persondoc.txt_reader=aclreader
        persondoc.txt_depositor=acldepositor
        persondoc.txt_noaccess=aclnoaccess
       
        Call persondoc.Save(True,False)   
        Print "count :" & n    & "for :" & profiledoc.mailfile(0)
        Set profiledoc=profilevw.Getnextdocument(profiledoc)
        n=n+1
    Wend
   
    Dim vc As NotesViewEntryCollection
    Set vc=profilevw.Allentries
    Call vc.Stampall("flag","Yes")
    MsgBox "Completed"
   
    Exit Sub
   
ErrorHandler:
    Call ActivityLogRTItem.AppendText( Now+ ": "&" Error in  :" +profiledoc.mailfile(0))
    Call ActivityLogRTItem.AppendText( Now+ ": Error " & Err() & ": " & Error() & "error line:" & CStr(Erl()))
    Call ActivityLogRTItem.AddNewLine( 1)
    Call LogDoc.Save(True,False)
    Resume Next
    'Exit sub
End Sub

ACL Extraction thru lotus script

Sub Initialize
On Error GoTo ErrorHandler
    Dim session As New NotesSession   
   
    Set curDB=session.Currentdatabase
   
    Set LogDoc=curDB.CreateDocument
    LogDoc.Form="LogForm"   
    LogDoc.Server=curdb.Server
    LogDoc.StartTime=Now
    Set ActivityLogRTItem = New NotesRichTextItem( LogDoc, "Rtxtlogactivity" )
    Call ActivityLogRTItem.AppendText( Now+ ": "&"Agent Started")
    Call ActivityLogRTItem.AddNewLine( 1)
   
    Set profilevw=curDB.Getview("Profile")
    Set profiledoc=profilevw.Getfirstdocument()
    n=1
    While Not profiledoc Is Nothing
        Set personDB=session.Getdatabase(profiledoc.mailserver(0), profiledoc.folder(0)+"\"+profiledoc.mailfile(0))
        Set caldoc=personDB.GetProfileDocument("CalendarProfile")
        Set persondoc = curDB.CreateDocument
       
        persondoc.Form="PersonInfo"
        persondoc.txt_mailfile=profiledoc.folder(0)+"\"+profiledoc.mailfile(0)
        persondoc.txt_mailowner=caldoc.Owner(0)
       
        'ACL
        Dim Acl As NotesACL
        Dim Aclentry As NotesACLEntry
        Set Acl=personDB.Acl
        Set Aclentry=Acl.Getfirstentry()
        Dim ctr As Long
        Dim ctr1 As Long
        Dim ctr2 As Long
        Dim ctr3 As Long
        Dim ctr4 As Long
        Dim ctr5 As Long
        Dim ctr6 As Long
       
        ctr=0
        ctr1=0
        ctr2=0
        ctr3=0
        ctr4=0
        ctr5=0
        ctr6=0
       
       
        Dim acleditor As Variant
        ReDim acleditor(0)
       
        Dim aclmanager As Variant
        ReDim aclmanager(0)
       
        Dim acldesigner As Variant
        ReDim acldesigner(0)
       
        Dim aclauthor As Variant
        ReDim aclauthor(0)
       
        Dim aclreader As Variant
        ReDim aclreader(0)
       
        Dim acldepositor As Variant
        ReDim acldepositor(0)
       
        Dim aclnoaccess As Variant
        ReDim aclnoaccess(0)
       
        While Not Aclentry Is Nothing
           
           
            If (Aclentry.Level = ACLLEVEL_EDITOR) Then
                If (ctr<>0) Then
                    ReDim Preserve acleditor(UBound (acleditor)+1)
                End If
                acleditor(ctr)=Aclentry.name
                ctr=ctr+1
            ElseIf (Aclentry.Level = ACLLEVEL_MANAGER) Then
                If (ctr1<>0) Then
                    ReDim Preserve aclmanager(UBound (aclmanager)+1)
                End If
                aclmanager(ctr1)=Aclentry.name
                ctr1=ctr1+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_DESIGNER) Then
                If (ctr2<>0) Then
                    ReDim Preserve acldesigner(UBound (acldesigner)+1)
                End If
                acldesigner(ctr2)=Aclentry.name
                ctr2=ctr2+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_AUTHOR) Then
                If (ctr3<>0) Then
                    ReDim Preserve aclauthor(UBound (aclauthor)+1)
                End If
                aclauthor(ctr3)=Aclentry.name
                ctr3=ctr3+1
               
            ElseIf (Aclentry.Level = ACLLEVEL_READER) Then
                If (ctr4<>0) Then
                    ReDim Preserve aclreader(UBound (aclreader)+1)
                End If
                aclreader(ctr4)=Aclentry.name
                ctr4=ctr4+1
               
               
            ElseIf (Aclentry.Level = ACLLEVEL_DEPOSITOR) Then
                If (ctr5<>0) Then
                    ReDim Preserve acldepositor(UBound (acldepositor)+1)
                End If
                acldepositor(ctr5)=Aclentry.name
                ctr5=ctr5+1
               
               
            ElseIf (Aclentry.Level = ACLLEVEL_NOACCESS) Then
                If (ctr6<>0) Then
                    ReDim Preserve aclnoaccess(UBound (aclnoaccess)+1)
                End If
                aclnoaccess(ctr6)=Aclentry.name
                ctr6=ctr6+1

            End If
           
           

            Set Aclentry = acl.GetNextEntry( Aclentry )
           
        Wend
       
        persondoc.txt_manager=aclmanager
        persondoc.txt_designer=acldesigner
        persondoc.txt_editor=acleditor
        persondoc.txt_author=aclauthor
        persondoc.txt_reader=aclreader
        persondoc.txt_depositor=acldepositor
        persondoc.txt_noaccess=aclnoaccess
       
        Call persondoc.Save(True,False)   
        Print "count :" & n    & "for :" & profiledoc.mailfile(0)
        Set profiledoc=profilevw.Getnextdocument(profiledoc)
        n=n+1
    Wend
   
    Dim vc As NotesViewEntryCollection
    Set vc=profilevw.Allentries
    Call vc.Stampall("flag","Yes")
    MsgBox "Completed"
   
    Exit Sub
   
ErrorHandler:
    Call ActivityLogRTItem.AppendText( Now+ ": "&" Error in  :" +profiledoc.mailfile(0))
    Call ActivityLogRTItem.AppendText( Now+ ": Error " & Err() & ": " & Error() & "error line:" & CStr(Erl()))
    Call ActivityLogRTItem.AddNewLine( 1)
    Call LogDoc.Save(True,False)
    Resume Next
    'Exit sub
End Sub