Solved

Saving a document on another server.

Posted on 2000-02-21
7
221 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now