You are not authorized to

Hello all,I wrote an agent to move a document from one db to another after a user clicks a cretain action by creating a new document in the detination db and deleteing the old document from the current database

here is my code:

Set session = New NotesSession

Set db = Session.CurrentDatabase ’ this db Payment

Set doc=session.DocumentContext

Set Ardb=session.GetDatabase(“Server1”,“payarchives.nsf”)

Set headerview =db.GetView(“Completed Payment Orders by id”)

Set Archivesview=Ardb.GetView(“Completed Payment Orders by serial”)

If Not doc Is Nothing Then

Set existingdoc=Archivesview.GetDocumentByKey(doc.serial(0))

If doc.Location(0)=0 Then

If Cstr(doc.Serial(0))<>“” Then

If existingdoc Is Nothing Then

Set CopiedHeaderDocument=Ardb.createdocument

CopiedHeaderDocument.form=“Payment Order”

Call doc.CopyAllItems( CopiedHeaderDocument, True )

Call CopiedHeaderDocument.computewithform(False,False)

Call CopiedHeaderDocument.Save( True,False )

’ this part is for deleting the document from original database

Set deletedheaderdoc=headerview.GetDocumentByKey(doc.id(0))

Call deletedheaderdoc.Remove(True)

End If

End If

End If

End If

although the user is an author to the form I get an error"You are not authorized to perform that operation"

in this line

Call CopiedHeaderDocument.Save( True,False )

why is that

does any one have an idea about this error

thanks in advance

Dalia

Subject: RE: you are not authorized to

Sounds like the user is not an author in the Database ACL, and so cannot create a document.

Subject: you are not authorized to

Re-inventing the wheel? why not just use doc.CopyToDatabase ?

Subject: RE: you are not authorized to

Hi Fungai,I cannot find it in the help what is doc.CopyToDatabase

thanks

Dalia

Subject: RE: you are not authorized to

Its a NotesDocument method. From the help:

CopyToDatabase method

Example

Copies a document into the specified database.

Defined in

NotesDocument

Syntax

Set newNotesDocument = notesDocument.CopyToDatabase( notesDatabase )

Parameters

notesDatabase

A NotesDatabase. The database in which you want a copy of the document. If you specify Nothing, this method generates an error.

Return value

newNotesDocument

The new document in the specified database.

Language cross-reference

copyToDatabase method in Java Document class

Example

See Also

Copying a document in LotusScript classes