Url to lotus note

HiI’m trying to make application that receives informations about new documents in Lotus database. It works fine, but now if I have this information (as noteID result of NSFSearch function from C-API), I wish to link to this document and open it in Lotus Notes Client. This function is available with this syntax:

Notes://server/database/document

For all documents we can see in properties (tab <*>) field Identifier his link.

Is anyone know how to build using CAPI this document link?

Makar

Subject: url to lotus note

Maciej,

It may be too late to help you, but I also needed this information, and the replies you got seemed to entirely miss the point of your question… so I’ll share what I learned, and hopefully someone else will benefit.

I’ll start by repeating your question in my own words:

As I understand it, you want to construct a notes:// URL programmatically using the C API. You have not specified what you will do with that URL once you have it – you just want to be able to programmatically generate URLs that work like the URLs you can see when you right-click a note, choose Properties, and look at the tab labeled “<+>”.

As you already know, the URL’s form is:

notes://<server_name>/<database_id>/<note_unid>

That seems like plenty of information, but actually getting those individual pieces isn’t completely obvious.

For a Notes database stored on the local system (which is all I care about in my case), use an empty string for <server_name>. Otherwise specify the notes server name (I assume you can use any hostname that can be resolved with sockets).

Getting the database ID given the database handle is pretty straightforward if you want to access the server’s database.

If you’re running on the client and have a handle to a note on a server, but you want the URL to point at a replica (I mention this because it’s what I needed, and my use case sounds similar to yours), you need to call NSFDbReplicaInfoGet and pull the ID from the resulting DBREPLICAINFO.

Getting <note_unid> isn’t TOO tough once you realize that it MUST BE THE UNID (not just the ID). Call NSFDbGetNoteInfo() (specifying the database ID and the note ID) and the resulting OID/ORIGINATORID (the third argument) will (sort of) contain the note UNID as its File and Note members. You just have to pull them out and put them in a UNID. For example:

OID noteOID;

NSFDbGetNoteInfo(hNoteDB, noteID, &m_noteOID, &lastMod, &noteClass);

UNID noteUNID;

noteUNID.File = noteOID.File;

noteUNID.Note = noteOID.Note;

Given that information, you just need to output a DBID and a UNID in the expected form. Here’s a printf() that will output a URL, assuming the you have a valid UNID called noteUNID, a valid DBID called dbID and a valid (possibly empty) null terminated string called serverName:

printf("notes://%s/%08x%08x/%08x%08x%08x%08x",

    serverName,

    dbID.Innards[1], dbID.Innards[0],

    noteUNID.File.Innards[1], noteUNID.File.Innards[0],

    noteUNID.Note.Innards[1], noteUNID.Note.Innards[0]);

Maybe there’s a more direct way to do that using the C API, but I didn’t find one in the documentation. If there’s a better way, hopefully someone will speak up.

Subject: RE: url to lotus note

A few minutes after I submitted this post and closed the browser window, I realized that I’d mistyped the format string. It’s been nagging at me, so I’m correcting it. The format string should be: “notes://%s/%08x%08x/%08x%08x%08x%08x”

Subject: RE: url to lotus note

Oops! In my “correction”, I pasted the original (incorrect) string rather than the corrected one. So… here’s what I meant to paste: “notes://%s/%08lx%08lx/%08lx%08lx%08lx%08lx”

Subject: url to lotus note

A clarification … the syntax is Notes://server/database/VIEW/document although you can use a “0” for the view part.

Subject: RE: url to lotus note

yes, thanks for clarification, but still don’t know how to build this link using C API. Need although document identification…

Subject: RE: url to lotus note

You would need to read the composite data records into memory, or into another buffer, using EnumCompositeBuffer, and at the place where you wanted the URL hotspot, you would need to add a series of composite data records with the hotspot included. Below is a sample set of CD records to add (pointing to your post, in this case).

If this, or other rich text manipulation, gets too complex, our Midas Rich Text C++ API will do all this simply and easily, without having to understand CD records and that sort of thing. In this case, you would just use the AppendLink method.

003 Record type: CD_TEXT [65413] Length: 18

Text: 'Here is a '

Font color: 0

Point size: 11

Face ID: 1

Style num: 0

FontID: 184549377

004 Record type: CD_BEGIN [221] Length: 6

Version: 0

Signature: 65453

005 Record type: CD_V5HOTSPOTBEGIN [65406] Length: 12

Type: 32 (RCLink)

006 Record type: CD_HREF [65526] Length: 117

Type: 1 (URL Resource)

ResourceClass: 0

Length1: 91 'Notes:///00256C3E0030650D/C21908BAF7E06EB085256A39006EAE9F/3BC2EE6D3D7C1DC185257250003E92E6'

ServerHintLength: 0 ''

FileHintLength: 0 ''

Flags: 0

007 Record type: CD_V4HOTSPOTBEGIN [65453] Length: 104

Type: 11 (HotLink)

Flags: 4104 NoBorder INotes

Data Length: 92

Data: 'Notes:///00256C3E0030650D/C21908BAF7E06EB085256A39006EAE9F/3BC2EE6D3D7C1DC185257250003E92E6'

008 Record type: CD_BEGIN [221] Length: 6

Version: 0

Signature: 65413

009 Record type: CD_TEXT [65413] Length: 12

Text: 'link'

Font color: 4

Point size: 11

Face ID: 1

Style num: 4

FontID: 184812545

010 Record type: CD_COLOR [210] Length: 8

Flags: 9

	Is RGB

	Use System color, ignore color here

R(ed)=: 0

G(reen)=: 0

B(lue)=: 255

Unused=: 0

011 Record type: CD_END [222] Length: 6

Version: 0

Signature: 65413

012 Record type: CD_V4HOTSPOTEND [174] Length: 2

013 Record type: CD_END [222] Length: 6

Version: 0

Signature: 174