Problem with EditDocument

Problem with EditDocument

Post by Reyer Snelle » Fri, 29 Dec 2000 07:11:35



Hi,

Is there anybody that would be so kind to take a quick look at my problem. I
use Delphi 4.0 and I'm writing an application that uses Notes as a server..
I have two procedures. The first I would like to use with Notes 4.6 and the
second with Notes 5.0. In the latter case I want to use the COM interface
with early binding. Since I only have version 5.0 on my system I'm testing
both
procedures first with 5.0

The first procedure works fine. The second results in an Exception telling
me that the EditDocument is used with an incorrect argument type and that an
object is expected.

There is hardly any difference in the two procedures. The main difference is
that the second (Y) is using COM.
Does anybody know why the second one is wrong?

regards
Reyer

var
  UIWorkspace, UIDatabase, UIView, UIDocument, OLESession,  OLEDatabase,
OLEView, OLEDocument;

  Session: Isession;
  View: Iview;
  Database: Idatabase;
  Document: IDocument;

Procedure x;
begin
UIWorkspace := CreateOleObject('Notes.NotesUIWorkspace');
UIWorkspace.OpenDatabase('','names.nsf','People',,,);

OLESession := CreateOleObject('Notes.NotesSession');
OLEDatabase := OLESession.GetDatabase('','names.nsf');

OLEDocument :=
OLEDatabase.GetDocumentByUNID('9F3F6CF6EC9BEB00C12569AC00682BDB');
UIWorkspace.EditDocument(False,OleDocument,False);
end;

Procedure y;
UIWorkspace := CreateOleObject('Notes.NotesUIWorkspace');
UIWorkspace.OpenDatabase('','names.nsf','People',,,);

Session := CoNotesSession.Create;
Session.Initialize('password');
Database := Session.GetDatabase('','names.nsf',False);

OLEDocument :=
Database.GetDocumentByUNID('9F3F6CF6EC9BEB00C12569AC00682BDB');
UIWorkspace.EditDocument(False,OleDocument,False);
end;

 
 
 

Problem with EditDocument

Post by Steve » Fri, 29 Dec 2000 08:54:30


There is no UIWorkspace (or UI-anything) in COM -- everything is derived
from Session.

You need to get a NotesSession in COM through the class
"Lotus.NotesSession."  Notes.* is the OLE stuff.  But since you want to open
a document for editing in the Notes client, maybe OLE is just what the
doctor ordered.

--Steve


Quote:> Hi,

> Is there anybody that would be so kind to take a quick look at my problem.
I
> use Delphi 4.0 and I'm writing an application that uses Notes as a
server..
> I have two procedures. The first I would like to use with Notes 4.6 and
the
> second with Notes 5.0. In the latter case I want to use the COM interface
> with early binding. Since I only have version 5.0 on my system I'm testing
> both
> procedures first with 5.0

> The first procedure works fine. The second results in an Exception telling
> me that the EditDocument is used with an incorrect argument type and that
an
> object is expected.

> There is hardly any difference in the two procedures. The main difference
is
> that the second (Y) is using COM.
> Does anybody know why the second one is wrong?

[snip]

 
 
 

Problem with EditDocument

Post by Reyer Snelle » Sat, 30 Dec 2000 07:39:59


Steve,

Thanks for your help. I see where I made a mistake now and confused things.
With your help I have been able to fix the problem.

Reyer



> There is no UIWorkspace (or UI-anything) in COM -- everything is derived
> from Session.

> You need to get a NotesSession in COM through the class
> "Lotus.NotesSession."  Notes.* is the OLE stuff.  But since you want to
open
> a document for editing in the Notes client, maybe OLE is just what the
> doctor ordered.

> --Steve



> > Hi,

> > Is there anybody that would be so kind to take a quick look at my
problem.
> I
> > use Delphi 4.0 and I'm writing an application that uses Notes as a
> server..
> > I have two procedures. The first I would like to use with Notes 4.6 and
> the
> > second with Notes 5.0. In the latter case I want to use the COM
interface
> > with early binding. Since I only have version 5.0 on my system I'm
testing
> > both
> > procedures first with 5.0

> > The first procedure works fine. The second results in an Exception
telling
> > me that the EditDocument is used with an incorrect argument type and
that
> an
> > object is expected.

> > There is hardly any difference in the two procedures. The main
difference
> is
> > that the second (Y) is using COM.
> > Does anybody know why the second one is wrong?
> [snip]

 
 
 

1. : Problem with EditDocument

Hi folks,

I have a *nice* problem with a Lotus Notes (Version 4.5.2b) Database and
the EditDocument method.

With documents, I want to be able to switch between the edit mode and
the show mode. Everything's fine when the current document is opened via
a view (that means that it has already been saved and re-opened). BUT
it's not working (a big red box telling me to close the application)
when I am in a brand new created document. I create a document, fill
some fields and then try to toggle the mode...

The code in the "toggle" button is the following :

Sub Click(Source As Button)
     Dim workspace As NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument

     Set workspace = New NotesUIWorkspace
     Set uidoc = workspace.currentDocument

     Call uidoc.Save
     Set doc = uidoc.document
     Call uidoc.Close
     Call workspace.EditDocument(False, doc)
End Sub

When in debug mode, I receive with the "call workspace.EditDocument" the
message :

"Notes Error - Specified Command is not available from the workspace".

I suppose that the workspace doesn't know that a document has just been
created and that it can't find it. I also tried a "call
workspace.ViewRefresh" but I get the same error.

I would be really pleased if you could give me some clues... Reply also
with an e-mail. Thanks

Vladimir

2. toshiba upgrade

3. EditDocument Problems in LotusScript from Linked Document

4. Netware Services

5. editDocument problem

6. WTB: game - Dragon Lord by Spotlight Software

7. Using EditDocument from within a document

8. MySQL & PHP

9. @command([EditDocument]) @setdocfield()

10. EDITDOCUMENT

11. Trouble with @COMMAND([EDITDOCUMENT])

12. doc for UIWorkSpace::EditDocument

13. workspace.EditDocument causes abend