Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Saving a document on another server.

Posted on 2000-02-21
7
224 Views
Last Modified: 2013-12-18
I am currently creating an agent that will save the document on another server and database. This agent is being called whenever the user clicks on the button.The document is a web page.The web page is on server A, what I want is when the user clicks on the button on the webpage, the document is saved on server B. The agent is shown below, but it does not seem to work.I use $$QuerySaveAgent to trigger the agent.
And also when should this agent run and which document should it act on?
'-----------------------------------
Sub Initialize
   Dim session as New notesession
   Dim doc as notesdocument
   Dim db as New notesdatabase("serverb","test.nsf")
Set db=session.currentdatabase
 Dim newdoc as notesdocument
set newdoc = New notesdocument(db)
set doc = session.documentcontext

Call doc.copyallitems(newdoc)
Call newdoc.save(True,False)
End Sub
_____________________________________















0
Comment
Question by:Barkley
7 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 2546290
Hi You are missing something in this code, the code should be like this

Sub Initialize
   Dim session as New notesession
   Dim doc as notesdocument
   Dim tgtdb as New notesdatabase("serverb","test.nsf")
Set db=session.currentdatabase
 Dim newdoc as notesdocument
set newdoc = New notesdocument(tgtdb)
set doc = session.documentcontext

Call doc.copyallitems(newdoc)
Call newdoc.save(True,False)
End Sub

PS:The db handle is overridden by the currentdatabase statement, I have created a new tgtdb to represent the foreign database


Good Luck
~Hemanth
0
 

Author Comment

by:Barkley
ID: 2549197
Yes Hemanth you are right the db should be different, I made some changes on the code so it would work on Notes, and it worked.But when I used the above code on the browser, it did not work.I think this method:
Call doc.copyallitems(newdoc)
Call newdoc.save(True,False)
does not work on browsers.Could you help me on what method will I use so that the document will be saved on a separate server and database?
Thanks a lot.
0
 

Author Comment

by:Barkley
ID: 2552842
Adjusted points to 103
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 2598898
Hi

Use CopyToDatabase method of NotesDocument, but u may have to save the currentdoc in the currentdatabase and remove it after it is copied to another database.

Good Luck
~Hemanth
0
 
LVL 3

Expert Comment

by:Simon_Hendry
ID: 2598978
Using this code on a browser will not work... From a background agent ( which is what the code is when it runs after you submit a form via a browser )  you cannot directly store documents in a non-local database.. You would have to store it locally and then replicate it to the other server.

So

   Sub Initialize
   Dim session as New notesession
   Dim doc as notesdocument
   Dim tgtdb as New notesdatabase("","test.nsf")
   Dim newdoc as notesdocument

   Set db=session.currentdatabase
   Set newdoc = New notesdocument(tgtdb)
   set doc = session.documentcontext

   Call doc.copyallitems(newdoc)
   Call newdoc.save(True,False)
   Call  tgtdb.Replicate("SERVERB")

   End Sub
0
 

Author Comment

by:Barkley
ID: 2606739
I created a lotuscript agent triggered from a browser, what it does is save the document directly to the other server. From the log file, it stated that you are not allowed to save a document from another server and database. We are thinking of using Java to do this. If we use Java, we can have servlets on each server and these servlets can pass data to each other whenever a document is being saved.We are still doing a research on Java RMI. Need help on this one. Thank you very much for your help.
0
 

Accepted Solution

by:
ysriprak earned 103 total points
ID: 2618395
Let your destination database to be MainIn Database, and send you document from front end to destination by mail.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question