We help IT Professionals succeed at work.
Get Started

CopyAllItems causing problem with permissions

andyhines
andyhines asked
on
219 Views
Last Modified: 2015-03-22
Hi,
It's been a while since I posted in here but I have an odd problem that I'm hoping someone can help me with.
I have a function in a script library which creates a new copy of my existing document. The document is a person record in an HR system and in the event that their position changes I want to create an archive copy of their old HR document.

Although the code works the new document can't be read or even seen by me. I can see it if I run Notes on the server and access the database that way. I do have Readers and Authors fields on the original document (Employee) and the archived copy (Employee Position). These fields still exist on the EP document and look to be correct but in fact their type has changed from Text List to Text.

Why does this happen ? What's the best way to copy a multivalue Authors field from one document to another ?

Code to do the copy is here:
Public Function CreateEPR As Integer
      
      Dim workspace As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim currentdoc As NotesDocument
      Dim db As NotesDatabase
      Dim session As New NotesSession
      
      Set db = session.CurrentDatabase
      Set doc = New NotesDocument(db)
      Set uidoc = workspace.CurrentDocument
      Set currentdoc = uidoc.Document
      
      currentdoc.CopyAllItems doc, False
      doc.Form="Employee Position"
      
      Call doc.Save (True,True)
      
End Function

The new copy of the documentOriginal-doc.PNG
Comment
Watch Question
Groupware Consultant
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE