LocationDocument LotusScript class updated

I updated my LocationDocument LotusScript class again for Location type (Local Area Network, No connection etc.) and for mail server name. It makes it really easy to quickly get at location document information from script.

See the original post for usage.

'/**
' * LotusScript class for interacting with location documents
' * in the personal name and address book.
' */
Public Class LocationDocument
   'declarations
   Private pSession As NotesSession
   Private pDb As NotesDatabase
   Private pDoc As NotesDocument

   '/**
   ' * Constructor
   ' */
   Public Sub New(get_location As String)
      'declarations
      Dim viewNab As NotesView
      Dim nn As NotesName
      Dim ini_location As String
      Dim location As String
      Dim comma As Integer

      'get session
      Set Me.pSession = New NotesSession()

      If get_location = "" Then
         'get the location from notes.ini
         ini_location = Me.pSession.GetEnvironmentString("Location", True)

         'parse out the location name if none specifed in the constructor
         comma = Instr(1, ini_location, ",")
         location = Mid$(ini_location, 1, comma-1)
      Else
         'use supplied location name
         location = get_location
      End If

      'abbreviate the name
      Set nn = New NotesName(location)
      location = nn.Abbreviated

      'get database and view
      Set Me.pDb = Me.pSession.GetDatabase("", "names.nsf")
      Set viewNab = Me.pDb.GetView("Locations")

      'lookup location document
      Set Me.pDoc = viewNab.GetDocumentByKey(location, True)
      If Me.pDoc Is Nothing Then
         Error 9999, "Location document not found in names.nsf"
      End If
   End Sub

   '/**
   ' * Saves.
   ' */
   Public Sub Save()
      Call Me.pDoc.Save(False, False)
   End Sub

   '/**
   ' * Property to get the backend document.
   ' */
   Public Property Get Document As NotesDocument
      Set Document = Me.pDoc
   End Property

   '/**
   ' * Property to get the e-mail address.
   ' */
   Public Property Get EmailAddress As String
      EmailAddress = Me.pDoc.GetItemValue("ImailAddress")(0)
   End Property

   '/**
   ' * Returns the name of the directory server.
   ' */
   Public Property Get DirectoryServer As NotesName
      If Me.LocationType = "3" Then
         Set DirectoryServer = Nothing
      Else
         Dim nn As New NotesName(Me.pDoc.GetItemValue("DirectoryServer")(0))
         Set DirectoryServer = nn
      End If
   End Property

   '/**
   ' * Sets the name of the directory server.
   ' */
   Public Property Set DirectoryServer As NotesName
      Call Me.pDoc.ReplaceItemValue("DirectoryServer", DirectoryServer.Canonical)
   End Property

   '/**
   ' * Returns the name of the Sametime server.
   ' */
   Public Property Get SametimeServer As NotesName
      If Me.LocationType = "3" Then
         Set SametimeServer = Nothing
      Else
         Set SametimeServer = New NotesName(Me.pDoc.GetItemValue("SametimeServer")(0))
      End If
   End Property

   '/**
   ' * Sets the name of the Sametime server.
   ' */
   Public Property Set SametimeServer As NotesName
      Call Me.pDoc.ReplaceItemValue("SametimeServer", SametimeServer.Canonical)
   End Property

   '/**
   ' * Returns the name of the mail server.
   ' */
   Public Property Get MailServer As NotesName
      If Me.LocationType = "3" Then
         Set MailServer = Nothing
      Else
         Set MailServer = New NotesName(Me.pDoc.GetItemValue("MailServer")(0))
      End If
   End Property

   '/**
   ' * Sets the name of the mail server.
   ' */
   Public Property Set MailServer As NotesName
      Call Me.pDoc.ReplaceItemValue("MailServer", MailServer.Canonical)
   End Property

   '/**
   ' * Returns the location type.
   ' * 
' * Local Area Network = "0" ' * Notes Direct Dialup = "1" ' * Network Dialup = "4" ' * Custom = "2" ' * No connection = "3" ' */ Public Property Get LocationType As String LocationType = Me.pDoc.GetItemValue("LocationType")(0) End Property End Class

Print from Adobe Acrobat using OLE

Just to have it somewhere… The code is from Visual Basic 6 with reference to the Acrobat TLD.

Private Sub Command1_Click()
    Dim doc As New AcroAVDoc
    If doc.Open("c:test.pdf", "PDF Print") Then
        Dim numPages As Long
        numPages = doc.GetPDDoc().GetNumPages
        Debug.Print "Document has " & numPages & " page(s)..."
        If doc.PrintPagesSilent(0, numPages - 1, 0, True, True) Then
            Debug.Print "Printed document..."
        End If
    Else
        MsgBox "failed to open document"
    End If

    If Not (doc Is Nothing) Then
        Call doc.Close(True)
    End If
End Sub

Is the Notes/Domino platform getting too complex?

Ben Poole posted a link to a rant on developerWorks (notes.net). The post addressed some of the same points that Nathan addressed some time back in his “Hourglass Community” post.

I think it is interesting that a post like this was posted to LDD not too long after Nathan posted about the same thing. I find it curiously interesting that the Notes/Domino platform turns more and more complicated and that the questions posted on LDD turn more and more basic… It could be that (real) developers simply get their information from other sources such as blogs and that those left in the forum really are the newbies. It could also be an indication that the platform getting increasingly complex is revealing to real problem for IBM Lotus.

How do we fix it? How do we get Notes/Domino developers to get smarter? It is really our, non-IBM’ers, job? Something to ponder over the weekend…

Discovering Notes 8: Spill-over from Eclipse


How’s this for Eclipse spill-over and a “free” feature that, at least for me, is the feature of the week? Try pressing Ctrl-F8 in your Notes 8 client…

Pressing the key-combination will bring up a keyboard navigateable list of open tabs. Select the tab you need with the arrow keys (or press Ctrl-F8 successive times) and press Enter. It’s basically the same as in Eclipse except in Eclipse it shows a list of active perspectives. In fact the Notes 8 client still refers to “perspectives” in the keyboard shortcut list.

Nice ha?

New URL for comments feed

Hmmm… seems like one address did change. Since I scrapped my custom Pebble version the comments feed is now at the default Pebble location: http://lekkimworld.com/responses/rss.xml.

Upgraded blog software

I have just finished upgrading my blogging server software (Pebble) from a custom version of version 1.9 to a standard version 2.2. Apart from file truncation issues the migration went fine. RSS feeds should be at their normal address and basically no one should actually see the change unless they visit the homepage. The only items missing is my custom theme. If you experience any problems please let me know by commenting or by sending me an e-mail (lekkim [at] heisterberg.dk).

One nice addition to Pebble 2.x is the support for comment thread RSS feeds which is something I really think the developerWorks blogs should implement. Apart from this there is a host of new nice features.

Discovering Notes 8: WSDL editing


If you’re running Notes 8 and starting to look into composite applications (CA) you’ll need a tool to edit WSDL files unless you’re the notepad-type. Even I is getting past that point and starting to resort to GUI editors so maybe you should to. Fortunately for us all there is no need to look further than your favorite IDE (which is even more true after Notes 8 has been released).

In Eclipse the WSDL editor is provided by the Web Tools Platform (WTP) Project which can easily be installed on top of the standard free Eclipse IDE. I used Eclipse 3.3 but you might as well use Eclipse 3.2 or even 3.1 I think.

Installation is as easy as 1, 2, 3:

  1. Add a remote update site to http://download.eclipse.org/webtools/updates/
  2. Once prompted for the components to install select “Web Standard Tools (WST)” feature in the “Web Tools Project (WTP)” category (see screenshot)
  3. Install and sit back and wait while the installation runs to completion

To show of the WSDL editing capabilities of the Eclipse editor I created a simple WSDL file with two math functions (add and subtract) as shown below.

Afterwards I imported the WSDL file into a Java web service in Domino Designer but it could as well have been LotusScript. Nice ha?

Discovering Notes 8: Calendar ghosting


Don’t know if it is obvious but if you’re running Notes 8 against a Domino 8 server, want to see calendar invitations you haven’t responded to (ghosted in the calendar) and you upgraded from a previous version of Notes you must manually enable it in the calendar profile. Do this by opening the calendar profile, go to the “Calendar & To DoDisplayViews”-tab and check “Display new (unprocessed) notices”.

Also it doesn’t appear to work on invitations you received prior to enabling the functionality… Could be that I simply wasn’t patient enough… 🙂