Search This Blog

Thursday, October 24, 2019

Non-ASCII filenames and NotesMimeEntity/NotesMimeHeader


If you need to compose outgoing email with NotesMIMEEntity and NotesMIMEHeader and send attachment with it then you can do it by writing something like this:

Dim body As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream
//Here we define root entity for the tree
Set body = NotesDoc.CreateMIMEEntity("Body")
Set header = body.CreateHeader("MIME-Version") 
Call header.SetHeaderValAndParams(|1.0|)
Set header = body.CreateHeader("content-type") 
Call header.SetHeaderValAndParams(|multipart/mixed|)

//Then we can create any number of needed child entities with plain text, html, inline images and so on
Set child1 = body.CreateChildEntity()
Call child1.SetContentFromText (someStreamWithSomeContent, "text/plain;charset=utf-8", ENC_NONE) 
Set child2 = body.CreateChildEntity()
Call child2.SetContentFromText (someStreamWithSomeContent, "text/html;charset=utf-8", ENC_NONE) 
Set child3 = body.CreateChildEntity()
Call child3.SetContentFromText (someStreamWithSomeContent, "whatever;charset=utf-8", ENC_NONE) 

//Finally we create an entity for file
Call stream.Truncate()
Call stream.Open(filepath, "binary") 

Set child = body.CreateChildEntity()
Set header = child.CreateHeader("Content-Disposition") 
Call header.SetHeaderValAndParams({attachment; filename="} & filename & {"})
Call child.SetContentFromBytes(stream, "application/octet-stream", ENC_IDENTITY_BINARY) 
child.EncodeContent ENC_BASE64 

Call stream.close()

The block above works good for files containing only ASCII characters in name.
However if you try to send file with name like éééééédoc.docx - you would not receive original filename but this - see below

Content-Type: application/octet-stream
Content-Disposition: attachment;
Content-Transfer-Encoding: base64

I have fixed this problem by changing line below:

Call header.SetHeaderValAndParams({attachment; filename="} & filename & {"})

To this:

Call header.SetHeaderValAndParams({attachment; filename*=utf-8''} & Join(Evaluate({@URLEncode("UTF-8";"} & filename & {")})))

Then you will get correct result:

Content-Type: application/octet-stream
Content-Disposition: attachment;
Content-Transfer-Encoding: base64

During testing I discovered that some of Mail-clients still displayed filename in a wrong way, f.x. filename could be correct in Notes-client but wrong in iNotes (Chrome).
I have fixed that last problem by replacing line

Call child.SetContentFromBytes(stream, "application/octet-stream", ENC_IDENTITY_BINARY) 


Call child.SetContentFromBytes stream, {application/octet-stream;name="=?utf-8?Q?} & Replace(Join(Evaluate({@URLEncode("UTF-8";"} & filename & {")})), "%", "=") & {?="}, ENC_IDENTITY_BINARY)

All credits to author of this post: from which I got the main idea.

Monday, September 10, 2018

(RESOLVED) Issues with Notes plugin after upgrading to 9.0.1FP10 - need some ideas from Notes/Java community where to dig up...


You've might already see this post:

Before choosing any direction for deep dive I would like to hear your opinion, may be this issue can be fixed with changes in Notes configuration or with some variable in plugin_customization.ini...

Here is the case.

There is a plugin (spell checker) working OK for ages for all versions of Notes prior FP10.

At first glance the problem happens because of lack of access rights - however I do not know now if this is because plugin was built for Eclipse 3x or because it is a bug or any other reason.

Let me show you some screenshots:

1) IBM Notes 9.0.1 FP9 - all works good.
The plugin can be successfully installed on IBM Notes 9.0.1 FP9 with or without administrator's access and it goes there:

The plugin-jars were copied to C:\Users\<username>\AppData\Local\IBM\Notes\Data\workspace\applications\eclipse\plugins\ and C:\Users\<username>\AppData\Local\IBM\Notes\Data\workspace\applications\eclipse\features\

2) IBM Notes 9.0.1 FP10 - there are issues.

2.1 Installation with administrator access rights - works OK but looks different

The plugin can  be successfully installed on IBM Notes 9.0.1 FP10 with administrator's access but it goes there:

The plugin-jars were copied to C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\plugins\ and C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\

2.2 Installation without administrator access rights - does not work 

Obviously, regular users usually do not have access to write anything into "Program Files (x86)" folder and that's most probably is a root of the problem.

I used some file monitoring software during plugin installation and saw a following picture during pluginc installation:

New C:\Users\User01\AppData\Local\VirtualStore\Program Files (x86)\IBM\Notes\framework\tmp.txt
New C:\Users\User01\AppData\Local\VirtualStore\Program Files (x86)\IBM\Notes\framework\shared\eclipse\tmp.txt
New C:\Users\User01\AppData\Local\VirtualStore\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features
New C:\Users\User01\AppData\Local\VirtualStore\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\tmp.txt
New  C:\Users\User01\AppData\Local\VirtualStore\Program Files (x86)\IBM\Notes\framework\shared\eclipse\plugins\tmp.txt
New C:\Users\User01\AppData\Local\VirtualStore\Program Files (x86)\IBM\Notes\framework\shared\eclipse\plugins\com.mycompany.contributed.custom.engine_1.0.1.jar1536594068341.tmp

Installation completed without any errors and Lotus Notes asked to restart.

Before restart I checked jar-files and found them in C:\Users\User01\AppData\Local\VirtualStore\Program Files (x86)\IBM\Notes\framework\shared\eclipse\...

When I tried to restart Lotus Notes - it never launched, hanged up on first windows with "Loading...Please wait".

I tried a following scenario: I reverted my VM back to the very beginning and before installing plugin again I provided EDITOR access to C:\Program Files (x86)\IBM\Notes\framework - with this change I successfully installed plugin with regular user.

Monitoring software showed following changes:

New C:\Program Files (x86)\IBM\Notes\framework\tmp.txt

New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\tmp.txt
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\tmp.txt
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\plugins\tmp.txt
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\plugins\com.mycompany.contributed.custom.engine_1.0.1.jar1536591689505.tmp
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\plugins\com.mycompany.contributed.custom.engine.dictionary_1.0.1.jar1536591689521.tmp
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\com.mycompany.contributed.custom.engine.feature_1.0.1\META-INF\MANIFEST.MF
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\com.mycompany.contributed.custom.engine.feature_1.0.1
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\com.mycompany.contributed.custom.engine.feature_1.0.1\META-INF
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\com.mycompany.contributed.custom.engine.feature_1.0.1\META-INF\LE-0A401.SF
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\com.mycompany.contributed.custom.engine.feature_1.0.1\META-INF\LE-0A401.RSA
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\com.mycompany.contributed.custom.engine.feature_1.0.1\feature.xml
New C:\Program Files (x86)\IBM\Notes\framework\shared\eclipse\features\com.mycompany.contributed.custom.engine.feature_1.0.1\feature1536591689552.xml
Modified C:\Program Files (x86)\IBM\Notes\framework\rcp\deploy\install.xml
Modified C:\Program Files (x86)\IBM\Notes\framework\rcp\

So, that's all basically...
My current issue is that I am not sure if it is a configuration issue or if I have to rebuild plugin using Eclipse 4x or something else...

I would be grateful for any ideas...

Update on 11.09.2018

Mikkel Flindt Heisterberg gave a head-shot (see comments under post).
So I managed to resolve the problem by adding 


to feature.xml and plugin was installed to user's directory instead of C:\Program Files (x86)\ and that was exactly I needed to.

Friday, September 7, 2018

(RESOLVED) Need help with installation of FP9/FP10: External VM is not valid - it must be a 1.5 or 1.6 Sun or IBM VM


Today I spent almost a whole day but couldn't install LN 9.0.1 FP10.
This is very embarrassing especially for the one working with Notes for more than 15 years.
Did I become too old?

The story:

1) I rolled out Hyper-V VM with x64 Windows 10 Enterprise (build 1803).
2) Installed standard 9.0.1 for multi users - all was good at this point.
3) Tried to install FP10 - failed with error "The wizard was interrupted before IBM Notes 9.0.1 FP10 could be completely installed.

I started googling by error text "The wizard was interrupted..." but all suggestions didn't work for me.
4) Eventually I didn't have any other options except looking into Installation.log.
I found there following error message:

Line 431: XPD: 9/7/2018 16:23:59 CActionsCommon/GetProperty: DEBUG - Retrieved property: RCP_INVALID_EXTERNAL_JVM_ERROR, Value: External VM is not valid - it must be a 1.5 or 1.6 Sun or IBM VM.

I started googling "External VM is not valid - it must be a 1.5 or 1.6 Sun or IBM VM" and found that FP6 had to fix that error.

So I cleand VM and did everything again, but this time I installed FP6 at first.
FP6 was installed successfully and I (feeling myself on the edge of a victory) started installation of FP10 but got the same dialog with "The wizard was interrupted...". However this time I spotted that error happened almost in the very beginning of FP10 installation - previously (without installation of FP6) it happened in the very end.

I checked installation log again and this time I found there something new:

Line 439: XPD: 9/7/2018 17:30:51 CActionsCommon/GetProperty: DEBUG - Retrieved property: RCP_INVALID_EXTERNAL_JVM_ERROR, Value: External VM is not valid - it must be a 1.5 or 1.6 Sun or IBM VM.
Line 613: 9/7/2018 17:31:06 2018-09-07T05:31:06.6--1:00 CCCUActionsApp/RenameDirectory: ERROR: Maximal retry time exceeded. Consider renaming failed.
Line 615: 9/7/2018 17:31:06 2018-09-07T05:31:06.6--1:00 UninstallJvmUpdate: ERROR: Failed to rename directory C:\Program Files (x86)\IBM\Notes\jvm to C:\Program Files (x86)\IBM\Notes\jvm_old: 5

I googled "Failed to rename directory jvm to jvm_old" - but I only found some posts where IBM confirmed the issue and included it into scope of following fixes but there wasn't any workaround suggested.

I discovered that FP8 worked OK the same as FP6 - the problems happened with FP9 and FP10 only.

That's all - I couldn't do anything eventually but trust me, I tried really a lot:
- I tried to disable Windows Defender, UAC, Firewall
- tried to change Notes folders permissions, owners;
- tried to install LN for a single user
- tried to use other path for installation
- I used some monitoring software trying to catch if any other processes works with Notes-folder during FP10 installation.
Nothing helped.

I would be grateful for any ideas please.

Update on 9.9.18
I managed to install FP10 IF4 - previously I tried to install FP10 IF2.

Still have issue with FP9 IF1 (SHF55).
I am going to try two things:
1) check if FP9 IF2 (SHF123) works OK.
2) try to use older build of Windows 10, for example 1709.
Update on 10.9.18

Installed FP9 as well.
The problem was with expired certificate in FP9 installation.
It is a bit shameful and strange in the same time: I had the problem with expired certificate in FP9 installation in past and even made a post about it but that time I clearly saw something about "expired signature" in installation logs. This time installation logs didn't have a word about certificate/signature error.
The difference in installation processes is that previously I used installation with Notes+Designer+Admin but this time I used Notes-only installation.
It's very sad that I forgot about this issue and wasted so much time.
Thank you very much to all who provided suggestions in comments to this post.

Tuesday, May 8, 2018

FP9 failed to install because certificate expired since Fri Apr 20


Today I wasted some time on issue with installation of FP9.

I reinstalled Windows on my laptop, installed IBM Notes client 9.0.1 and then tried to install FP9 using setup file I used many times before. However this time installation failed. At first I thought it was caused by my Windows because I like to disable in Windows everything I can. However when I tried to install FP9 on another VM I had got the same issue:

I read logs provided by FP9 installation but didn't find anything helpful there, just

CustomAction PreRunProvisioning.5F3129E8_3AD4_4346_AEE6_A314E2DE64D9 returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 18:51:01: InstallFinalize. Return value 3.

Then I checked logs in IBM\Notes\Data\workspace\logs and found there a following line:

CWPST1015W: Plugin failed to install.   
The reason provided is CWPST1002W: Signature has expired

Then I googled this post and used workaround by adding setting to plugin_customization.ini - worked OK for me.

Wednesday, January 17, 2018

xsp.domino.view.navigator=ByNoteId - does not work if data source is located on another Domino server


You might know that categorized Xpages views built (for example) via <xp:viewPanel> by default work slower than they actually could. IBM worked on this problem in past and since Domino R9.0.1 you could add a following line


into of your application and performance of categorized views would become much nicer.

This workaround always worked OK for me but it seems it does not work in case if your data source (f.x. back-end view) is on another server (tested with 9.0.1 FP9 HF139)

Here is a screen shot of a view before I click on any category

 Here is a screen shot after I clicked on category "Event"

It works OK if data-source is in the same database or in another database on the same server.

Sunday, January 14, 2018

Xpages - building issue


Yesterday I wasted several hours because of issue with building of Xpages in one of my apps. As usually, it happened suddenly, like, I was developing a few hours and all was OK but then my last changes refused to appear/work and I always got an old version of Xpage that I was working on.

I personally did not use "Build Automatically" option enabled as many people suggested but even so I still had building issues from time to time. Previously I resolved all such issues by cleaning my project up or by complete restarting of Lotus Notes client and then rebuilding again.

However this didn't work the last time.
I tried really a lot: checked that generated java-classes in /local/xsp really had my last changes, cleaned up everything related to my project in IBM\Lotus\Notes\Data\workspace\ and then rebuilt the project again, performed fixup and compact, re-created the db and then replaced design with template made from the last version of my app and so on - nothing helped.

Fortunately I had a LIVE version of this app while I was working in DEV version so I could compare project properties and this helped me to discover that by some mysterious reason this folder was removed from build path - adding it back resolved the issue.

Hope this will save time for someone.

Monday, August 7, 2017

Appending MIME item to NotesRichTextItem

Hi guys

May be this will save someone's day.

The story:
Some external UI posts HTML-data to Notes.
That HTML has to be added to NotesRichtextItem.

1) When I tested simple case manually all worked OK:

1.1) Here is my Notes form

1.2) I put some data in Notes document and save it
1.3) Then I run an agent over this document with code like

Sub Initialize
Dim s As New NotesSession
Dim doc As NotesDocument
Dim rt1 As NotesRichTextItem
Dim rt2 As NotesRichTextItem

Set doc = s.Documentcontext
Set rt1 = doc.getfirstitem("RTBody")
Set rt2 = doc.getfirstitem("MIMEBody")

Call rt1.Appendrtitem(rt2)

Call, False)
End Sub

1.4) The result is what I need

2) However when I create MIME item via lotusscript the result of merging was wrong: