Manage Learn to apply best practices and optimize your operations.

LotusScript to detach userid files from address book

This tip describes using Lotus Script to detach userid files from address book.

I was faced with a tricky issue of detaching all users id files from address book and saving them on hard disk. Also I had to delete the id files from address book after the copy.

This script Renames the users id files as Shortname_Firstname_Lastname.id and stores them in c:attach folder. Remember to make the folder before executing the script.

This method also logs the names of all persons for which it has detached the id's.


Sub Initialize 

Dim currentLog As New NotesLog
( "Script log" )
Call currentLog.OpenFileLog
( "c:attachlog.txt" )
Dim s As New notessession
Dim db As notesdatabase
Set db = s.currentdatabase
Dim doc As notesdocument
Dim view As notesview
Dim object As NotesEmbeddedObject
Set view = db.getview("People")
Set doc = view.getfirstdocument
Dim vc As NotesViewEntryCollection 
Set vc = view.AllEntries
Set object = doc.GetAttachment( "userid" ) 
Messagebox vc.count


For i = 2 To vc.count
Set object = doc.GetAttachment( "userid" )

If ( object Is Nothing ) Then

Call currentLog.LogAction( "UN_Successfull 
: " &doc.shortname(0) & ":" &doc.
FirstName(0) & ":" & doc.LastName(0))

Set doc = view.GetNthDocument(i) 
Else 

Call currentLog.LogAction( "Successfull 
: " & doc.shortname(0) & ":" &doc.
FirstName(0) & ":" & doc.LastName(0))
Call object.ExtractFile ( "c:Attach" & doc.
shortname(0) & "_" &doc.FirstName(0) 
& "_" & doc.LastName(0) & ".id")
Call object.Remove 
Call doc.save(True,True)

Set doc = view.GetNthDocument(i)
End If


Next

Messagebox "finished"

Call currentLog.Close



End Sub

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close