Open user's person document

Is there any code which when written in a button can open the person document of the user who clicks on it.

Any help would be greatly appreciated. Thank You…

Subject: Open user’s person document

Yes-

Something like: (partial code)

Set NABdb = New notesDatabase(db.Server,“Names.nsf”

Set NABpeople = NABdb.getView(“($VIMPeople)”)

Set NABdoc = NABPeople.GetDocumentByKey(UserName , True)

If Not NABdoc.Is Nothing Then

Set maildoc = New notesdocument(db)

maildoc.form = “Memo”

Set rtitem = maildoc.createRichTextItem(“body”)

Call rtitem.AppendDocLink(NABdoc,NABdb.filename)

Call maildoc.send(False , SendTo.Abbreviated)

End If

Subject: Open user’s person document

Before I show the code, I will ask the following:

  1. Did you search the forum before posting your question? Probably not: http://www-10.lotus.com/ldd/nd6forum.nsf/search?SearchView&Query=open%20AND%20person%20AND%20document%20AND%20button&SearchOrder=1&SearchMax=0&SearchWV=TRUE&SearchFuzzy=TRUE&Start=1&Count=100"

  2. Did you search Designer help?

Please do these things before posting!!!

This script will do what you are seeking:

Sub Click(Source As Button)

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim nam As NotesName

Set nam=session.CreateName( session.username)

Dim strName As String

strName=nam.Abbreviated

Dim dbNames As NotesDatabase

Set dbNames=session.GetDatabase

   ("<ServerName>","Names.nsf")

If dbNames.IsOpen Then

   Dim viewNames As NotesView

   Set viewNames=dbNames.GetView("($VIMPeople)")

   Dim docName As NotesDocument

   Set docName=viewNames.GetDocumentByKey(strName, 

        True)

   If Not (docName Is Nothing) Then

   Call ws.EditDocument(False, docName)

   End If

End If

End Sub

Subject: Open user’s person document

Something like this?

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/a4f2000bc5f971e0852572030034faf7?OpenDocument

Subject: RE: Open user’s person document

Only problem with that one is that it asks the user to customize the NAB, when there are already built in views available:-(

I just wish people like the poster of this question would search the forum first!

Subject: RE: Open user’s person document

I really didn’t look at the results of my search query, but took the first hit. Good point, though.

/sarcasm on

I am so glad that 3 of us provided an answer and that the poster has thanked us for our help.

/sarcasm off

And then people wonder why it is so hard sometimes to get help on this forum.

sigh