Sub Initialize 
	Dim w As New NotesUIWorkspace 
	Dim s As New NotesSession 
	Dim db As NotesDatabase								' current db 
	Dim col As NotesDocumentCollection				' collection of selected docs 
	Dim ownersprompt As Variant							' result list from selecting new owner(s) 
	Dim doc As NotesDocument							' doc in col currently being processed 
	Dim item As NotesItem									' reusable item fld 
	 
	Set db=s.CurrentDatabase 
	Set col=db.UnprocessedDocuments 
	 
	' test for no docs selected 
	If col.Count=0 Then 
		Messagebox "No name(s) selected" , , "Canceled" 
		Exit Sub 
	End If 
	 
	' get new owner list from user 
	ownersprompt = w.PickListStrings( 0 ) 
	If ( Isempty( ownersprompt ) ) Then  
		Messagebox "No replacement name(s) selected" , , "Canceled" 
		Exit Sub 
	Else 
		Print "Processing " & Cstr(col.Count) & " documents..." 
		' replace owner field contents 
		Set doc=col.GetFirstDocument() 
		While Not (doc Is Nothing) 
			' loop and process 
			If (Lcase(doc.Type(0))="group") Then 
				Set item= doc.ReplaceItemValue("ListOwner", ownersprompt) 
				item.IsNames=True 
				Call doc.Save(True,False) 
				Print "Updated: " & doc.ListName(0) 
			Else 
				Print "Skipped: " & doc.Form(0) 
			End If 
			Set doc=col.GetNextDocument(doc) 
		Wend 
		Print "Processed " & Cstr(col.Count) & " documents. Done." 
		Messagebox "Completed " & Cstr(col.Count) & " processing documents" , , "Done" 
	End If 
	 
	 
End Sub
  
previous page
 
  |