logo

New Response

« Return to the blog entry

You are replying to:

  1. I use a web agent to open the profile doc.

    Ex. /xx.nsf/WAGetProfile?OpenAgent&Name=ProfileDocName

    the code for WAGetProfile

    Sub Initialize

    On Error Goto ERRORHANDLER

    Dim session As New NotesSession

    Dim db As NotesDatabase

    Dim docCntxt As NotesDocument

    Dim docProfile As NotesDocument

    Dim sName As String

    Dim sUNID As String

    Dim sDBURL As String

    Set db = session.CurrentDatabase

    sDBURL = db.FilePath

    sDBURL = Replace(sDBURL, "\", "/")

    sDBURL = Replace(sDBURL, " ", "%20")

    Set docCntxt = session.DocumentContext

    sName = subUrlQueryString(docCntxt.Query_String(0), "Name" )

    If sName = "" Then

    Print |Error in Agent: | & session.CurrentAgent.name & |<br>| & docCntxt.Query_String(0) & |<br>| & |<a href="javascript: onClick=history.back()">Back</a>|

    Exit Sub

    End If

    Set docProfile = db.GetProfileDocument(sName)

    If docProfile Is Nothing Then

    Print |Error in Agent: | & session.CurrentAgent.name & |<br>| & docCntxt.Query_String(0) & |<br>| & |<a href="javascript: onClick=history.back()">Back</a>|

    Exit Sub

    End If

    docProfile.LOG = "1"

    docProfile.FORM = sName

    Call docProfile.Save(True, True)

    sUNID = docProfile.UniversalID

    Print |<html><head><script>document.location='/| & sDBURL & |/0/| & sUNID & |?OpenDocument'| & |;</script></head></html>|

    Exit Sub

    ERRORHANDLER:

    Print |Error in Agent: | & session.CurrentAgent.name & |<br>| & |Ln: | & Str$(Erl) & | Err: | & Str$(Err) & | | & Error$ & |<br>| & |<br>| & |<a href="javascript: onClick=history.back()">Back</a>|

    Err = 0

    Exit Sub

    End Sub

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: