Warum kannst Du in der ScriptLibrary keine Session erzeugen?
Dass es sich nicht um einen Agent handelt ist kein Grund.
aus der Hilfe ...
import lotus.domino.*;
public class platform1 extends NotesThread
{
public static void main(String argv[])
{
platform1 t = new platform1();
t.start();
}
public void runNotes()
{
try
{
Session s = NotesFactory.createSession();
// To bypass Readers fields restrictions
// Session s = NotesFactory.createSessionWithFullAccess();
String p = s.getPlatform();
System.out.println("Platform = " + p);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Da isser :-).
gehe hierallerdings nicht über main sondern habe eine funktion init
import java.util.Vector;
import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.NotesException;
import lotus.domino.NotesFactory;
import lotus.domino.NotesThread;
import lotus.domino.RichTextItem;
import lotus.domino.Session;
public class Tools extends NotesThread
{
Session mSession=null;
//*************************************************************************************************
public Tools(){
}
public void init()
{
System.out.println("Init = ");
Tools t = new Tools();
t.start();
try {
mSession = NotesFactory.createSession();
} catch (NotesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (mSession == null )
System.out.println("Session in init is null");
System.out.println("msession = "+mSession.toString());
}
//*************************************************************************************************
public void runNotes()
{
try
{
mSession = NotesFactory.createSession();
// To bypass Readers fields restrictions
// Session s = NotesFactory.createSessionWithFullAccess();
if (mSession == null )
System.out.println("Session is null");
String p = mSession.getPlatform();
System.out.println("Platform runNotes = " + p);
}
catch (Exception e)
{
e.printStackTrace();
}
}
//*************************************************************************************************
public void SendCallInfoMailFromLS (String iSender,String iRecipient,String iDOCUID)
{
try {
if (mSession== null)
System.out.println("Session in SendCallInfoMailFromLS is null");
System.out.print("Session is "+mSession.toString());
//Document lDoc=lSession.getCurrentDatabase().getDocumentByUNID(iDOCUID);
//SendCallInfoMail(iSender,iRecipient,lDoc,lSession);
} catch (Exception e) {
System.out.println("SendCallInfoMailFromLS in SendCallInfoMail");
System.out.print(e.getMessage());
e.printStackTrace();
}
}
//*************************************************************************************************
}
Sub Postsave(Source As Notesuidocument)
If Source.FieldGetText("SendMailAdjuster")="Yes" Then
Dim lSender As String
Dim lReceiver As String
Dim lDoc As NotesDocument
Dim ToolClassObj As JavaObject
Dim js As New JAVASESSION
Dim ToolClass As JAVACLASS
Dim lSession As New Notessession()
Dim x As String
Set lDoc = Source.Document
lSender="Hans Wurst"
lReceiver="hans Wurst"
Set ToolClass = js.GetClass ("Tools")
Set ToolClassObj = ToolClass.CreateObject ()
Call ToolClassObj.init ()
Call ToolClassObj.SendCallInfoMailFromLS(lSender,lReceiver,Source.Document.UniversalID )
End If
End Sub
Danke für deine Mühe :) . Aber nochmals zur Grundfrage, kann ich nicht einfach meine lSession aus dem LS mit übergeben ? Da kommt ja wie gesagt der Type Mismatch.
Warum wundert mich das nicht :'( . Ich denke ich packe alles in einen Agenten und übergebe die NoteID
status = notesAgent.Run( [ noteID$ ] )
Dann komme ich auch an mein Dokument ran.
So ist es halt wenn mans schön haben will und wiederverwendbaren Code unter Lotus haben will.
Ich danke Dir auf jedenfall für den Input.
Viele Grüße