Domino 9 und frühere Versionen > Entwicklung
Personendokument per Script ändern
Axel Janssen temp:
such z.B. hier mal nach Excel. Da gibt es die einschlägigen OLE-mässigen Lösungen.
http://searchdomino.techtarget.com/tips/0,289484,sid4_tax283833,00.html
Vermutlich gibt es ähnliches auch in der Sandbox.
koehlerbv:
Wenn Du noch Anfänger bist, ist eine solche Aufgabe vielleicht nicht der beste Start.
Wenn Du trotzdem damit anfangen möchtest: Starte erstmal mit dem erforderlichen Rahmen (Zugriff auf NAB, dort Docs finden etc.). Wenn Du dort sicher bist, kannst Du Dich dem Thema Excel-Import widmen (gute Beispiele gibt es hier oder in der Sandbox unter www.notes.net - der Suchbegriff "excel" leitet Dich direkt zu einem Excel-Import-Codebeispiel).
HTH,
Bernhard
Daniel:
Hallo Zusammen!
Ich hab gestern noch etwas in der Sandbox gestöbert.
Der Excelimport funktioniert schon mal super. Ich hab auch ein codebeistpiel gefunden, welcher den Zugriff zum NAB macht und das Internetpasswort ändert. dort muss ich nun nur noch einbauen, dass die Weiterleitungsadresse gelöscht wird.
Zuerst lese ich das Excelfile ein und dann braust ein Agent durch, der jedes Dokument in Angriff nimmt.
Ich denke ich bin da auf dem richtigen weg.
Danke für die Sandboxtipps, muss ich öfters reinschauen.
Daniel
Daniel:
Hallo Zusammen!
Ich hab nun fast schon alles erledigt für diese Anforderung. Allerdings hab ich noch ein kleines Problem.
Es wird ein Agent gestartet, der die Dokumente im NAB ändert. Dieser Agent nimmt aber nicht alle Dokumente in der DB wie ich es eingegeben habe, sondern nur das letzte.
Was kann das sein?
Ich hab noch den Quelldings vom Agentent:
(Nicht alles selbstgeschrieben, nur angepasst)
Sub Initialize
Set session = New Notessession
' Gets the current document
Set curdoc = session.DocumentContext
' Gets the primary address book
Set dbNames = session.GetDatabase("hbdo01/heizboesch","names.nsf")
' Gets the hidden view of person documents
Set viewNames = dbNames.GetView("($VIMPeople)")
' Gets the person document for the user
Set docNames = viewNames.GetDocumentByKey(curdoc.GetItemValue("UserName")(0), True)
Print "DocNames ausgeführt"
' Give error if user is not located in address book
' This can happen if user has not logged in the server or if username is in some secondary address book
If docNames Is Nothing Then
Print "[/" & curdoc.GetItemValue("DbPath")(0) & "/message?OpenForm&1]"
Exit Sub
End If
' Gets the current password entered by user
'currentPassword = curdoc.GetItemValue("CurrentPassword")(0)
' Gets the new password entered by user
newPassword = curdoc.GetItemValue("NewPassword")(0)
' Gets the encoded password stored in user's person document
'passwordInAddressBook = docNames.HTTPPassword(0)
' Gets the encoded form of the current password
'temp = Evaluate({@Password(CurrentPassword)}, curdoc)
'encodedCurrentPassword = temp(0)
' Checks current password entered by user against the password stored in his person document
'If ( encodedCurrentPassword <> passwordInAddressBook ) Then
'Print "[/" & curdoc.GetItemValue("DbPath")(0) & "/message?OpenForm&2]"
'Exit Sub
'End If
' Gets the encoded form of the new password
temp = Evaluate({@Password(NewPassword)}, curdoc)
encodedNewPassword = temp(0)
' Updates the person document
docNames.HTTPPassword = encodedNewPassword
' Löscht die Forwardingadress aus dem Personendokument
docNames.MailAddress = ""
Call docNames.Save(True, False)
Print "[/" & curdoc.GetItemValue("DbPath")(0) & "/message?OpenForm&3] - Passwort geändert"
' End
End Sub
Danke
Semeaphoros:
Das liegt wohl daran, dass Du mit Session.DocumentContext auf das aktuell in der Ansicht "angemalte" Dokument zugreifst, sprich also das aktuelle Dokument verwendest. Wenn Du alle Dokumente haben willst, musst Du eben die DocCollection der aktuellen Ansicht durchlaufen, da gibts Beispiele in der Hilfe, schau Dir mal NotesDocumentCollection zum Beispiel an. Und auch die Eigenschaft "CurrentView" im NotesUIWorkspace
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln