How to export your .id file from your domino directory


There is some old notes directories which are containing the users.id in the person document.

This is not a good practice…

The following lotus script allows you to creat an agent action to remove the user id in the person document and export them in the temp directory. The script create the name of the .id with the name of the user.

Could be very useful when auditing a customer installation… tell me about it.

Sub Initialize

Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim nitem As Variant

Dim dc As notesdocumentcollection

Dim szDirectory As String
Dim nomId As String
Dim iSeq As Integer

‘ — dest directory
szDirectory = “c:\temp\”

‘ — Init
Set db = session.CurrentDatabase ‘Set db to the current database
Set dc = db.unprocesseddocuments
Set doc = dc.GetFirstDocument ‘Set doc to the first document

‘ — go through the view
While Not (doc Is Nothing) ‘Still documents to process

‘ — 0 attachment
iSeq = 0

Forall i In doc.Items ‘Run through everything
If i.type = Attachment Then
Set nitem = doc.GetFirstItem(i.name) ‘who are you?
Set emb = doc.GetAttachment(i.values(0)) ‘a pesky user id?

‘ — Detach it
If iSeq = 0 Then
nomId = szDirectory + doc.shortname(0) + “.id”
emb.ExtractFile(nomId)
iSeq = iSeq + 1
Else
nomId = szDirectory + doc.shortname(0) + Trim(Str(iSeq)) + “.id”
emb.ExtractFile(nomId)
iSeq = iSeq + 1
End If

‘ — Remove IT
Call emb.remove ‘C-ya!
End If
End Forall

Call doc.save(True,True) ‘Save more secure person doc
‘Because the first parameter is True, the document gets saved, even if someone else edits the document while the script runs.

Set doc = dc.GetNextDocument(doc) ‘Set doc to the next document
Wend

End Sub

Advertisements

About pierrekoerber
Hey, pour faire connaissance, laisse-moi un message... drop me a line.

3 Responses to How to export your .id file from your domino directory

  1. Patrick Ozoux says:

    Excellent, Thanks for sharing

  2. Graeme Miller says:

    Hi,
    I get a Variant does not contain an object pop-up when I try to run it. any Idea ?

  3. Pissed off user says:

    Ya, stop what you are going before you piss off all your users!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: