Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Saving a document on another server.

Posted on 2000-02-21
7
Medium Priority
?
229 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
[X]
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
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 206 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

730 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