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