My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

Hi

I have a lotusscript code in which I am looping through all documents in a folder. Whenever a document meets a certain criteria,

I remove the document from the folder. But I have noticed that the code I have results that the getnextdocument method jumps over a view documents.

In other words it does not process all documents.

Set doc = vw.Getfirstdocument

Do While Not (doc is nothing)

'looking if the doc meets the criteria

Set Tempdoc = doc

Set doc = vw.GetNextdocument(doc)

if not Tempdoc is nothing then

Call Tempdoc.RemoveFromFolder(“Strvw”)

Set Tempdoc = Nothing

end if

Loop

How comes that when i use the RemoveFromFolder method the code jumps over a view documents? Or is my code just wrong?? If I remove the line from the code

the script processes all documents.

Regards

Subject: My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

If you want to remove all documents from folder, you can use removeAllFromFolder function.

Dim vc As NotesViewEntryCollection

Set view = db.GetView(“Strvw”)

Set vc = view.AllEntries

call vc.removeAllFromFolder(“Strvw”);

Subject: re: My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

Try: view.AutoUpdate = False

You may prefer to start by getting a collection of matching docs using a search. Then process the collection.

The other responses might be helpful in some contexts too.

Subject: My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

HiI have the same problem but I doesn’t find the solution for this problem…

Did you find a solution???

I have already checked the “view.AutoUpdate”-function, but nothing helped…

Can you help me?

Subject: RE: My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

Hey All,

I am currently am having the same problem. Has anyone noticed that the agent exits at exactly the 1/2 way point of the unprocessed documents in the view.

Also if a solution has been found please post your code.

Thanks,

Adam

Subject: RE: My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

Just come across this queue and would like to provide my idea. Hope it is not too late.

What I usually do is put all the docs that should be removed from the folder to a second collection. After I get all the docs, I will call the collection.removeallfromfolder method at the end of the process. That works for me all the time.

Regards,

Lisa

Subject: RE: My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

The problem is likely that the view or folder is categorized on a multi-value field.

The pointer gets confused as to what the next document is because the same document appears in multiple places with multiple next document choices.

In this scenario, you likely will need to remove everything from the folder or view and then with asearch find everything to put back in.

Subject: My Lotusscript code does not process all documents in the view when using the method RemoveFromFolder

Try:

Set doc = vw.Getfirstdocument

While Not (doc is nothing) 'looking if the doc meets the criteria

Set nextdoc = vw.GetNextdocument(doc)

Call doc.RemoveFromFolder(“Strvw”)

Set doc = nextDoc

Wend