• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 782
  • Last Modified:

Given NoteID, view it with C API?

I have a notes add-in menu for the Actions menu written in C using the Notes API. I can get the NOTEIDs of all the notes I selected and I was wondering how I can "launch" these notes for the purpose of issuing a print and then closing the note. Any suggestions?
0
wym
Asked:
wym
  • 4
  • 3
  • 3
2 Solutions
 
qwaleteeCommented:
I don't know that you really can do this, because there are no API provisions for manipulating the UI, at least, none that I know of.

What you could perhaps do is use the OLE automation classes to do this.  Instantiate Notes.NotesSession and Notes.NotesUiWorkspace.  Use NotesSession to open the database, and get a document object by note ID. Then use NotesUiWorkspace to return a NotesUiDocument object by calling NotesUiWorkspace.editDocument, passing it the document object retrieved earlier.  Finally, use teh NotesUiDocument object to print.
0
 
wymAuthor Commented:
Thanks for the suggestion, we tried to do exactly that.  I have a VB app to use Notes OLE automation by passing it a list of the UIDs that I got from my Add-In dll.  Unforunately, when I use NotesUIDocument.Print, it says method not supported...  I guess this is because it doesn't support COM?  

Is there any other way I can approach this?
0
 
ArunkumarCommented:
Try reading on .NDL extension files.  If possible build the .ndl file (which is very simple text file) and launch this file it will launch notes and the corresponding document.

FYI:
To get a sample .ndl file copy a document as link and paste it in notepad. Save file it with extention .ndl  thats it.  Now double click this .ndl file to see it launch notes and its corresponding document.


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
wymAuthor Commented:
Thank you Arunkumar:

If I can build and launch this file, is there anyway I can detect the load  event to fire off a print and then close it?  Do I do this with an agent?

Sorry about these simplistic questions... I got parachuted in because I know C but I have no clue about LN and the C API turned out to be a bust.
0
 
ArunkumarCommented:
yes you can do the print and close it too... all you have to do is in the postopen event of the form have a file print and also close.

Warning...Whenever this document is opened...it will be printed and closed but not open for reading....
0
 
qwaleteeCommented:
That's an interesting appraoch, having the PostOpen fire off a print and close, and build a link file to just get Notes to launch it.  

I don't know why NOtesUiDocument.Print did not work for you ... the docs say it shold work in COM (i.e., it is not listed as an unsupoprted method in COM).  Do other notesUiDOcument commans work for you, e.g., gotoField?

If you want to use the Postpen kludge, do sometheing like this:

In form PostOpen:
Dim s as new NotesSession
If s.getEnvironmentString("PrintImmediatelyOnPostOpen") = "True" Then
   s.setEnvironmentVar "PrintImmediatelyOnPostOpen , "False"
   Source.Print
End If

In your VB code:
docID = .....
Dim s as new Lotus.NotesSession
s.Initialize
s.setEnvironmentVar "PrintImmediatelyOnPostOpen , "True"
Dim ws as new Notes.NotesUiWorkspace
ws.editDocument False , s.getDatabase( .... , ....).getDocumentByKey(docID)
0
 
wymAuthor Commented:
Well, in the end we didn't go with the NDL.  I  don't have much experience with LN and my job was finished when I made the UID listing.  I was just testing it out in VB if I could print it.  Apparently, in the actual product, my boss has an intermediate form he launches with VB giving users choices to print all (mail, attachments), mail, or attachments.  I guess the buttons run the LotusScript code in the  PostOpen to print and close from reading the listing.  He says he's almost got it working and is ironing out some minor hiccups...  

However, I'd still like to know why .print doesn't work for me in VB(Object doesn't support this property or method).  I tried other commands like gotofield (Document command is not available), the only one that worked for me so far is IsNewDoc.

I don't know if this problem is related, but there seems to be a problem with uidoc if LN is not maximized.  Personally, my LN is maximized...

http://www.geocities.com/TimCottee/downloads/basLotusNotesModules1.txt

I'm also wondering if it has to be with using a VB app as an external process to LN and LN is not in the foreground.  Perhaps if I used the OLE automation writtin in CPP along with my Add-In menu?  I'd like to learn that, is there any code samples for CPP?



0
 
ArunkumarCommented:
My part is over I guess.... LOL !!!

:-)
0
 
wymAuthor Commented:
Actually, I was going to split the points.  I haven't closed it yet because my boss might still need some answers ;)  Plus, it would be good experience for me to learn about OLE in CPP... I just can't find any good examples of it for LN.  It can't hurt to learn a new skill since they are always bugging me about LN and I'm know crap about it!  They believe everything can be done throught the API and clearly I don't think so.
0
 
qwaleteeCommented:
There are some C++ API examples, but I don't think any OLE code examples.  That's because Notes is usually an OLE container, not an OLE server (it is a server only for automation control or for NDL links).

You really need a good general-purpose book on C++ OLE or C++ ActiveX.  Once you have the general background, the Notes specifics will eb a piece of cake.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now