wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Investigate notes:// links.


You are sending out emails that contain Notes links to other email systems. The router converts them to notes:// links (and with a little help even into good looking HTML mails). However when you click the document in your target database doesn't open, even if you have a Notes client installed. Now you need to investigate what is happening. These are the steps:
  • Open your windows registry using regedit
  • Look for HKEY_Classes_Root\Notes, which is the protocol handling definition for Lotus Notes. It should look like this:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Notes]
    @="URL:Notes Protocol"
    "URL Protocol"=""
    
    [HKEY_CLASSES_ROOT\Notes\DefaultIcon]
    @="C:\\Notes\\notes.exe,0"
    
    [HKEY_CLASSES_ROOT\Notes\shell]
    
    [HKEY_CLASSES_ROOT\Notes\shell\open]
    
    [HKEY_CLASSES_ROOT\Notes\shell\open\Command]
    @="\"C:\\Notes\\notes.exe\" -defini \"%1\""
    
    Note, that your path to the Notes location might be different.
  • With this fixed Notes will pickup Notes URLs and display them correctly. However there are more possible caveats. One could be the Notes URL in the email, the other the way the email application is calling the Windows function to launch Notes
  • The syntax for a Notes URL is notes://servername/database/view/documentuniqueid (For a full description see the online help). If you omit the documentuniqueid Notes will open the view (the view can be specified by name or by unid), when you omit documentuniqueid and view Notes will open the database.
  • When you create a link from a local database the server name is missing, so the Notes URL has a triple slash notes:///database/.... The Notes client will look for it locally. If the database is not local (or on the desktop) it will throw an error. With a little help you can force server names even if the database was created locally.
  • Sometimes the mail application isn't calling the notes url properly. This is a little harder to investigate. You need to edit your registry to point the URL protocol to something else than notes.exe, so you see what is exactly handed over at the command line (You backup your registry, isn't it?). I've written a small Java class that can do that for you. So instead of @="\"C:\\Notes\\notes.exe\" -defini \"%1\"", you would write: @="\"java.exe\" C:\\temp\\CommandlineSpy.class \"%1\"". The little class will spit out a prompt with the URL handed over to the OS.
import java.awt.Frame;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class CommandlineSpy {

  /**
   @param args
   */
  public static void main(String[] args) {
    
    String message;
    
    if (args.length < 1) {
      message = "No command line parameters provided";
    else {
      message = "Commandline parameters used:\n";
      for (int i = 0; i < args.length; i++) {
        message += Integer.toString(i+1":";
        message += args[i];
        message +="; ";
      }
    }
  
    CommandlineSpy s = new CommandlineSpy()
    
    s.box(message);
        
        System.exit(0);
  }
  
  public void box(String message) {
    Frame f = new Frame();
    f.setSize(400,400);
        f.setVisible(false);
        MessageBox box = new MessageBox(f , message, true);
        box.dispose();
        f.dispose();
  }
  
  private class MessageBox extends Dialog implements ActionListener {
    private static final long serialVersionUID = 1L;
    private Button ok, can;
    public boolean isOk = false;

    /**
     @param frame parent frame
     
     @param msg message to be displayed
     
     @param okcan true : ok cancel buttons, false : ok button only
     */
    public MessageBox(Frame frame, String msg, boolean okcan) {
      super(frame, "Message"true);
      setLayout(new BorderLayout());
      add("Center"new Label(msg));
      addOKCancelPanel(okcan);
      createFrame();
      pack();
      setVisible(true);
    }

    MessageBox(Frame frame, String msg) {
      this(frame, msg, false);
    }
    
    void addOKCancelPanel(boolean okcan) {
      Panel p = new Panel();
      p.setLayout(new FlowLayout());
      createOKButton(p);
      if (okcan == true)
        createCancelButton(p);
      add("South", p);
    }

    void createOKButton(Panel p) {
      p.add(ok = new Button("OK"));
      ok.addActionListener(this);
    }

    void createCancelButton(Panel p) {
      p.add(can = new Button("Cancel"));
      can.addActionListener(this);
    }

    void createFrame() {
      Dimension d = getToolkit().getScreenSize();
      setLocation(d.width / 3, d.height / 3);
    }

    public void actionPerformed(ActionEvent ae) {
      if (ae.getSource() == ok) {
        isOk = true;
        setVisible(false);
      else if (ae.getSource() == can) {
        setVisible(false);
      }
    }

  }

}
Java2html

Posted by on 25 February 2009 | Comments (5) | categories: Show-N-Tell Thursday

Comments

  1. posted by Rick VanGameren on Wednesday 25 February 2009 AD:
    I've been using a toolbar icon with pretty good success. I've found that client installs >= R6 understand notes: // urls.

    dbn:=@LowerCase(@DbName);
    db:=@ReplaceSubstring(@Subset(dbn;-1);"\\";"/");
    svr:=@Name([CN];@Subset(dbn;1));
    id:=@Text(@DocumentUniqueID);
    u:="notes: //"+svr+"/"+db+"/0/"+id+"?opendocument";
    @Prompt([OkCancelEdit];"url";"here it is";u)


    Creates a url like;
    notes: //misfarm01ds/mail/rvangame.nsf/0/9E08C6E4E5D050DE8525756800502442?opendocument

    (spaces entered after : to display text of urls rather than links)

  2. posted by Christian Henseler on Thursday 26 February 2009 AD:
    Instead of modifying the registry, it might help to add the Notes data directory to the system path.

  3. posted by Stephan H. Wissel on Thursday 26 February 2009 AD:
    @Christian: in a properly installed system you don't need to touch the registry, the installer did that for you. However there are cases where the Notes directory has been just copied from another machine and the settings are missing.
    You *want* to change the registry to investigate what other applications are sending over to the handler of { Link }
  4. posted by ICeman on Saturday 14 November 2009 AD:
    Great program. But cannot compile.
    On line 28, where says
    message += argsi;
    should be
    message += args[ i ];
    (had to put spaces on the brackets to bypass the BBCode)
    Works great Emoticon biggrin.gif
  5. posted by Atish on Friday 18 June 2010 AD:
    Can I create a NOTES : //xxxx?CreateDocument uri? I looked in Help and found nothing.