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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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?
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.

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.

Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

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.
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 will be printed and closed but not open for reading....
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"
End If

In your VB code:
docID = .....
Dim s as new Lotus.NotesSession
s.setEnvironmentVar "PrintImmediatelyOnPostOpen , "True"
Dim ws as new Notes.NotesUiWorkspace
ws.editDocument False , s.getDatabase( .... , ....).getDocumentByKey(docID)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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...

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?

My part is over I guess.... LOL !!!

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.
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.