I am trying to remove hotspots from Note body using C API.
I know one way to do this:
1) NSFNoteOpen(hDb, noteId, 0 /*NO FLAGS*/, &hNote);
2) Enumerate allTYPE_COMPOSITE items, Keep appending all CD records in separate buffer except records between SIG_CD_HOTSPOTBEGIN and SIG_CD_HOTSPOTEND
3) remove this item and append newly created item.
4) NSFNoteUpdate(hNote, UPDATE_FORCE);
But problem is that, all Rich text infomations is lost
Is it possible to achieve the same when note is opened with
OPEN_RAW_MIME flag? There are no TYPE_COMPOSITE items in the note in this case.
Thanks
You need to determine the type of the Body field and act accordingly. I.e., if the Body is stored as TYPE_COMPOSITE, you already know what to do. But if the Body is stored as TYPE_MIME_PART, you need to use the Notes C API calls whose names all start with "MIME". You can find these functions listed in the Notes C API Reference. Here are a couple of blog posts that talk a bit about some related subjects.
Related
An email arrives into a mail-in database. I look at it and see that it has a single Body item, which is Rich Text.
In an agent run after new mail arrives, I want to update the arriving memo, and append some text to that Body item and then save it. I use getfirstitem to get a handle on it, and then use AddNewLine and Appendtext in successive lines of code, adding a bit of text to it, before saving it.
After this is done, I look at the backend document again and where there used to be a single Body item there are now two. Each has a portion of what I expected a single item to have. Between the two, nothing is missing.
Note: The incoming email also has attachments...but it did originally before I updated it and again, there was only one Body item.
Note2: Sending the email from Outlook. How that could be related I don't know.
What could be causing this or what might I do to work around this. Open to all suggestions/ideas.
Thank you
Matt Smith
If you call Compact on the Body after you've finished adding to it (and before saving if you do an explicit save), that might reduce it to a single item, but it's not guaranteed.
There are cases where Body is forced to be 2 or more items. E.g.:
If an email comes in as MIME (which is common for emails from outside your network), each MIME part is always a separate Body item, and there are normally 2 or more MIME parts for a single email.
I think each rich-text item has a strict 64 kB size limit for the raw data, so content exceeding 64 kB will always be 2 or more items, but I'm not sure of this.
As others have said in comments, it's normal to have more than 1 item for rich-text content. You should never have to care about this. If you use GetFirstItem to get a rich-text item and add text to the end of it, it will act like one item from an end-user perspective.
I decided on another way to accomplish what i needed, not appending text, so this question is no longer in need of help, other than to sate my own curiosity. Thanks guys.
I've been developing in Lotus (IBM) Notes/domino for something like 25 years and I've never come across this before.
The application is Notes client based, using Notes 9.
I open a document (DOC A) , which uses FORM A. From this document, there is a button to create a new document which uses FORM B. This opens in a new window. DOC B is not a response of DOC A, but some (a lot) of LotusScript copies fielse from DOC A to DOC B.
So now we have 3 windows open: The original application, the DOC A doc and the DOC B.
I make edits to DOC B, and save it. I close it, leave DOC A open, and navigate to another view where DOC B can be found.
Interrogate the Document Properties field list to see the field I edited ("InvoiceComments" in my case). Yep, my text is there.
Then I run a script agent which gets DOC B and prints up the content of InvoiceComments. It's blank. Write a Web agent to get same doc ... my text can be found in InvoiceComments.
It's definitely the same document, same UNID etc.
So that is: When looking at Document Properties, fields list, I can see myy edits in the field values. When running a script via Notes Client to get that document (either via UnprocessedDocument or from a view), the field has its 'old' value (blank)
The only clue I have as to what's going on is that if I close the DOC A, then all of a sudden the agent that prints "InvoicComments" value starts to honour what's on the disk (ie, it behaves).
Sounds like a bug in the notes client, but I'm at a loss as to how to get around it because people will want to do the process above.
I had this some time ago when working with big script libraries and global variables.
I needed a LOT of debugging to find out what was wrong.
Essentially the problem is: As long as there is a variable ANYWHERE in the code that holds the document Doc A, then any script -run from whatever context- will get the "old" values of that document (despite the frontend showing you the changed item value).
Either Delete the NotesDocument- Object holding doc A in any code from doc B or use Set .... = Nothing to prevent that from happening.
So using either of these two lines will help:
Delete docA
Set docA = Nothing
I can't take credit for this code, a consultant wrote it, but maybe this pattern will fix your problem:
Set doc=uidoc.Document
newentry=doc.CommentEntry(0)
id=doc.Universalid
Call uidoc.Fieldclear("CommentEntry")
Call uidoc.Save
Call uidoc.Close(True)
Set doc=db.GetDocumentByUNID(id)
doc.CommentEntry=newentry
He found that even when you have a "valid" document object with a valid UNID, when you have it open as a UiDoc, Notes (frustratingly) keeps a copy in memory, so he had to resort to this idea. (Is it a bug or just a quirk?) I think this is essentially what Torsten is suggesting as well.
I work in a development/support team which has a shared Lotus Notes mailbox. We need to be able to associate an issue ID with each email. We started by adding this ID to the subject line (eg. "Something doesn't work [ID12345]"). For performance reasons, our IT dept don't allow indexing of shared mailboxes, so it takes a long time to search for a particular ID.
I decided to add a new ID field, which can be shown as a sortable column in views and folders. I put this field to the visible header (just below 'Subject') in the ($All) view and the ($Inbox) folder, and copied the ($Inbox) design to all the other folders in the database. That much was easy.
My problem is that when we reply or forward, this custom field is not carried over to the new memo, so we have to manually add it again before sending. And of course when the user responds, the field is again missing and must be manually added. I have searched the docs and the internet and haven't found any information on this. Either I have to declare this field as something which persists across replies and forwards, or I have to add a line somewhere which explicitly copies the field contents to the new memo.
fsw,
We do exactly this with our complaint system however our database is indexed although this should not be an issue to you. We created a view that is sorted by ID by extracting just the ID from the subject line, order it by ID and then by date descending. Base it on the $ALL folder view so you get both incoming and sent emails.
We then altered the memo form to include an embedded view single category of the new view that sits above the body which shows all other documents linked to the ticket.
This should avoid having to delve to far into the very complex mail template any further. One thing is to make sure you have a copy of the changes you made and a bit of doco re deploying as you can guarantee that one day your template will be completely overwritten in an upgrade and all your good work will be gone.
As the additional field would have to incorporated into all Memo forms in mail templates in your corporation and as these fields do not easily travel via SMTP, you should stick with the ID in the subject.
What you could do is to parse the subject (#Mid, #Right, ...) in the column formula in the view and only display the ID there (like you did with the additional field).
The other option I envision if having a field is required is to have an agent that processes the incoming message(reply) to have it parse out the issue ID from the subject and write it to the field. You could also do that with queryopen or postopen if running an agent is not possible
I am using Visual Studio 2010, SharePoint 2010 with custom document content types and forms. And plan to also use jquery to build the document add/edit/view forms.
I am developing a solution where I want to have a document library where each document uploaded also has a number of external data elements added as metadata.
The tricky part I'm trying to figure out is I want the user to be able to specify and add a multiple number of those same external data elements.
I'm trying to figure out how I represent the data internally in SharePoint. My initial thought is to programmaticly add hidden external fields as the users adds those external selections. But then I also think of simply storing those external elements as non-external text fields but have my own code which performs the external data lookup and validation.
I'm not adverse to significant custom coding, as I'm probably going to need to do a lot anyway since even the user interface is going to be a jquery tabbed form to enable all the external data the user will be able to associate with each SP document.
I've made an attempt to hopefully further explain what I'm trying to do and included that image. Essentially I'm wanting to add 1+ external data relationships to each document, as desired by the user.
It uses just example data. I'll actually have 4-7 different complex relationships much like the example. And the user is permitted to drilldown and select 1, 2 or all 3 of the dropdowns.
Think of it as similar to how here on Experts-Exchange we can add multiple zones to a question.
An example illustration is here: http://flic.kr/p/aFUSJn
Could you simply add a multi-line text column and have the user input the metadata with comma's, then use your code to seperate the data and do what you want with it?
You said you were not adverse to significant custom coding :)
One solution is to use SharePoint content types. The trick is that not all items in a list need to have the same content type.
Therefore, you can do the following:
As the user is selecting the fields he wants to use you generate or select a content type that matchs those fields.
You then add your document to the document list using the content template
You then have all your information strongly typed in SharePoint lists.
We have previously built a system where we generate content types based on xsd files, this worked very well.
I am working on a new web app in lotus/domino. I am newer to lotus/domino programming, so forgive me for not knowing something simple.
What I am trying to do is display a table of information, with one of the columns containing a link. The link is formatted like [http://server/app.nsf/form?openform&ideaNum=1&var2=foo2]
How can I retrieve the information from the url, to get information from a view or a document?
So far I have tried to access the query string in the webQueryOpen event, but lotus runs the agent before the DOM writes to the browser, the query_string isn't available.
I am not sure how else to get information from one form to another in lotus.
Thanks for the help.
-Kris
If you're passing multiple params in the query_string, you can get Domino to do a bit more of the work for you. There's an Function command - UrlQueryString - that can format the params into a list, delimiting at the "&".
E.g. server/app.nsf/form?openform&ideaNum=1&var2=foo2
becomes a list:
openform
ideaNum=1
var2=foo2
To use it, on the destination form create a multi-value text field called something like "QryStringList".
Set it to be computed when composed, and set it's value to #UrlQueryString.
In your WebQueryOpen agent, you can access the params as doc.QryStringList(0), docQryStringList(1) and so on, if you're using Lotusscript.
I'm fairly sure I put this together using info from the IBM/ldd forum, but the exact source is lost in the mists of time and memory, so apologies if I've copied someone's post.
Just as a follow up, I found that you are able to specify an on form variable named the same as QUERY_STRING. The variable is actually a reserved term for Lotus, so Lotus pre-fetches the variable before running the information out the browser.
Due to the pre-fetching, you are able to access the url information during the webQueryOpen event.
I hope this helps someone else looking for the same type of functionality.
-Kris