Using Notes 6.5.3, C++ API 3.0
Is there any documented evidence that the C++ API works for Java Script Libraries?
It seems to me that it is fundamentally impossible to either create or edit java script libraries. Check out what I have tried so far:
Attempt
===========
Do it the obvious way!
Db.GetAgent(AgentTitle, &JavaAgent);
JavaAgent.Open();
JavaAgent.GetJavaCode(&CompiledAgentJava);
Db.CreateScriptLibrary(Title, LNSCRIPTLIBRARYTYPE_JAVA, &ScriptLib);
ScriptLib.Open();
ScriptLib.CreateJavaCode(CompiledAgentJava, &CompiledScriptLibJava);
ScriptLib.Save();
BUGS:
1) Gets Error unable to perform operation due to unopened note
2) Creates LotusScript library NOT java, in spite of LNSCRIPTLIBRARYTYPE
Attempt
===========
Force a save using Createxxxx in the other mode, then reopen lib and add code
Db.CreateScriptLibrary(Title, LNSCRIPTLIBRARYTYPE_JAVA, 0);
Db.GetScriptLibrary(Title, LNSCRIPTLIBRARYTYPE_JAVA, &ScriptLib);
ScriptLib.Open();
ScriptLib.CreateJavaCode(CompiledAgentJava, &CompiledScriptLibJava);
ScriptLib.Save();
BUGS:
1) Gets Error unable to perform operation due to unopened note
2) Creates a Java Library (yay) with NO code (boo!)
============================================================
OK! Have proved that you cannot CREATE java script libraries.
Maybe we can edit them?
==============================================================
Attempt
==========
Try and copy an existing library and add java code. Maybe can
update the code that way or maybe use C API to create $FILE, just test it out
THe script library is created by hand via UI
Db.GetScriptLibrary(Title, LNSCRIPTLIBRARYTYPE_JAVA, &ScriptLib);
ScriptLib.Open();
ScriptLib.CreateJavaCode(CompiledAgentJava, &CompiledScriptLibJava);
ScriptLib.Save();
BUGS:
1) Error: Script library with the specified name and type already exists.
duh-uh! I just opened it...
Attempt
===========
Buwahaha, i will change the name so it saves it under a different name! I am
UNBEATABLE! It seems GetScriptLib does not open a lib, it creates a brand new copy
from the original. No adding any new java this time, just confirm that you CAN
open and save a java script lib
Db.GetScriptLibrary(Title, LNSCRIPTLIBRARYTYPE_JAVA, &ScriptLib);
ScriptLib.Open();
ScriptLib.SetName("New Library");
ScriptLib.Save();
Bugs:
1) Error: unable to perform operation due to unopened note
It does actually create New Library, and as a Java lib too! gosh! Maybe i can just ignore
error?
Attempt
==========
Lets go beserk and actually add some code. Exciting...
Db.GetAgent(AgentTitle, &JavaAgent);
JavaAgent.Open();
JavaAgent.GetJavaCode(&CompiledAgentJava);
Db.GetScriptLibrary(Title, LNSCRIPTLIBRARYTYPE_JAVA, &ScriptLib);
ScriptLib.Open();
ScriptLib.SetName("New Library");
ScriptLib.CreateJavaCode(CompiledAgentJava, &CompiledScriptLibJava);
ScriptLib.Save();
Bugs:
1) Error: unable to perform operation due to unopened note
2) Some extra fields added including a $FILE Wooh!!! But... the script library
has now been miraculously converted to a LotusScript library.
============================================================
OK! Have proved that you cannot EDIT java script libraries. Er... what else...
============================================================
Exactly what QA (if any?) was done on these classes, especially the LNScriptLibrary class, before releasing them? I would be interested to find out what exactly DOES work. Even a response to the effect that it does not work at all would help… a bit…
Simon