简体   繁体   中英

NotesDocument Add HotSpot/Hyperlink as NotesRichtextItem

I am trying to add a link to a NotesDocument , which should have a displayname different from the actual link.

How can I do this via C#-code? I cannot use NotesMIMEEntity .

This is what I have done so far. Bu I cannot figure out how to change the displayed tag of the link into Google for example

NotesSession nSession = new Domino.NotesSession();
nSession.Initialize(pw);
NotesDatabase nDatabase = nSession.GetDatabase("SERVER", "names");                 
Domino.NotesDocument nDocument = nDatabase.CreateDocument(); 

nDocument.ReplaceItemValue("Subject", "Test"); 

NotesRichTextItem rtItem;                               
rtItem=  nDocument.CreateRichTextItem("Body");
rtItem.AppendText("http://google.com"); //I cannot see a "AppendLink" Method or sth. alike
nDocument.Send(false,"email@company.com"); 

Unfortunately, there's no way that I know of to do this with arbitrary links. Not without either using MIME, which you've said you can't use, or DXL, or a 3rd party API like MIDAS.

But if you know in advance the exact link that you want to append, then the technique that I have used is to create a form for a configuration document with a key field and rich text field, which I'll call richTextLink. Manually create a document with this form, giving it the key LinkToGoogle, and use the Create - Hotspot (or Create - Hyperlink in Notes 9) to create your link in the rich text field. Create a view for your config docs, with the first column sorted by the key field. Then, in your code, open that view, use cfgDoc = view.getDocumentByKey("LinkToGoogle") to get the doc, then use linkRTItem = cfgDoc.getFirstItem("richTextLink") and rtItem.AppendRTItem(linkRTItem) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM