[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

Removing documents from a folder

Greetings learned colleagues,

Silly question I know but I haven't been able to figure out how to remove a set of documents from a folder. For example, I have moved a set of documents to a folder, done my processing and want to remove but not delete all the documents from that folder once it's done. When I try to remove the documents one at a time, only one gets deleted. I'd like to be able to remove them all. I know I need to get these docs in a collection but how do I do that within a folder? I am on Domino R7.0.1.

Regards - NotesRookie
0
notesrookie
Asked:
notesrookie
  • 2
  • 2
  • 2
  • +1
1 Solution
 
SysExpertCommented:
You need to put them in another folder if you do not want to delete them.

You can put them in the Inbox, or create a folder called - Processed, and put them there.



I hope this helps !
0
 
notesrookieAuthor Commented:
I'm trying to do a RemoveAllFromFolder but can only do that with a notes document collection. I'm trying to figure out how to get a collection of documents already in that folder to remove them so as not to do double processing for the next go around. Thanks.
0
 
SysExpertCommented:
Are you trying to do this automatically via an agent, or via a button where the user  selects the folder ?

If the latter, simply have them select all the docs in the folder, if the former, you should be able to go through all the docs and add them to a collection .


I hope this helps !
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Bill-HansonCommented:
There are 2 ways that I know of.  One that operates on all documents in the database and one that only operates on the documents in the folder.  Which one is faster depends on the application.

This one removes all documents in the database.  Since RemoveAllFromFolder only processes the documents that are in the folder, this is ok.

      Dim sess As New NotesSession()
      Dim db As NotesDatabase
      Set db = sess.CurrentDatabase
      On Error Resume Next
      Call db.AllDocuments.RemoveAllFromFolder("FolderName")

This one gets all of the documents from the folder into a NotesDocumentCollection, then removes them from the folder.  It requires an additional function (ViewGetAllDocuments) also included below.

      Dim sess As New NotesSession()
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim dc As NotesDocumentCollection
      Set db = sess.CurrentDatabase
      Set view = db.GetView("FolderName")
      Set dc = ViewGetAllDocuments(view)
      On Error Resume Next
      Call db.AllDocuments.RemoveAllFromFolder("FolderName")


      Public Function ViewGetAllDocuments(view As NotesView) As NotesDocumentCollection
            
            '/**
            ' * Builds a document collection containing all documents in a view.
            ' * @param view The view to query.
            ' * @return A document collection containing all documents in a view.
            ' */
            
            Dim dc As NotesDocumentCollection
            Dim doc As NotesDocument
            Set dc = DcCreate(view.Parent)
            Set doc = view.GetFirstDocument()
            Do While (Not doc Is Nothing)
                  Call dc.AddDocument(doc)
                  Set doc = view.GetNextDocument(doc)
            Loop
            Set ViewGetAllDocuments = dc
            
      End Function
0
 
notesrookieAuthor Commented:
Bill-Hanson,

That's what I was looking for. I could not find anything in Designer help. I was trying to figure out to add a document to a collection. Thanks.
0
 
Bill-HansonCommented:
I just realized that I excluded a dependent function.  Here's the DcCreate function that appears in ViewGetAllDocuments.  It doesn't do much, but I've included it for completeness...

Public Function DcCreate(source As NotesDatabase) As NotesDocumentCollection
      
      Set DcCreate = source.Getprofiledoccollection("__NOTHING__")
      
End Function
0
 
qwaleteeCommented:
If you need a separate script to do the rmeoval (i.e., a "empty folder" button, not something incorporated into a larger procesisng engine), then your most efective way is to use the UI

@Command([OpenView]; nameOfFolder ; ""; "1" );
@Command([EditSelectAll]);
@Command([RemoveFromFolder]);
@Command([FileCloseWindow])
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now