About This Code
Brief Description:
Open database listed in an email ( like GSX errors )
Notes Version:
R6.x, R8.x, R7.x
Last Modified:
03 Nov 2008
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Sub Initialize
' posted to http://www.openntf.org/projects/codebin/codebin.nsf/CodeByDate/BB07663266C769D2862574F60054154B
' written by Mike Mortin, 20070830
Dim ws As New NotesUIWorkspace
Dim uiDoc As NotesUIDocument
Dim nServer As NotesName
Dim tempStr As String, fileList As String, server As String
Dim tempVar As Variant
Dim index As Integer
Const kDelim = " "
' get email content
Set uiDoc = ws.CurrentDocument
tempStr = uiDoc.FieldGetText("body")
' split and join to remove unwanted characters
tempVar = Split(tempStr, Chr(13)) ' new line characters
tempVar = Join(tempVar, kDelim)
tempVar = Split(tempVar, "'") ' single quotes
tempVar = Join(tempVar, kDelim)
' lastly, split into words
tempVar = Split(tempVar, kDelim) ' spaces
' server name is the next entry
Set nServer = New notesName(tempVar(3))
server = nServer.Common
' then parse through remaining entries to get all mailfiles listed
For index = Lbound(tempVar) To Ubound(tempVar)
Print tempVar(index)
If Instr( tempVar(index), ".nsf" ) > 0 Then
' add it to the list
tempStr = Left( tempVar(index), Instr( tempVar(index), "nsf") +2 )
fileList = fileList & tempStr & ","
End If
Next index
' now, did we find any mail files?
If Len(fileList) > 0 Then
' make the list and tighen it up
tempVar = Split( fileList, "," )
tempVar = Arrayunique(tempVar)
tempVar = Fulltrim(tempVar)
' present and open the db
tempStr = ws.Prompt(4, "Select the database on " & server & " that you want to open.", "Click 'Cancel' to exit.", "", Split( fileList, "," ))
If tempStr <> "" Then Call ws.OpenDatabase(server, tempStr)
Else
Msgbox "No mailfiles detected"
End If
End Sub
Usage / Example
If you get GSX error messages, the databases in question are always listed in the email. I wrote this because I got tired of opening the email, selecting the text containing the NSF I wanted to examine, going File -> Open -> etc, browsing to the server, and pasting the copied text in. This is so much simpler.
This script, which can be placed in whatever mailfile receives these types of messages ( likely your personal mailfile ). Just open the message and run the agent. You will be prompted with a list of NSFs from the email. Pick one and the agent will open it for you.
It currently doesn't work with messages in the preview, only when fully opened.