AnsweredAssumed Answered

HELP delete node with WS API

Question asked by luisalves00 on Oct 27, 2010
I'm inserting a batch of files into the repo.
but if something fails in the middle of the insertion, I want to remove the already inserted ones (Rollback).

When inserting I'm storing the References (RepositoryService) in the insertedNodes. Then if an exception occurs I use this code:

private void TryToRollback(ArrayList insertedNodes) {
            if (insertedNodes.Count > 0)
            {
                try
                {
                    insertedNodes.Reverse(); //start from last child
                    CML cml = new CML();
                    CMLDelete cmlDelete = new CMLDelete();
                    Predicate predicade = new Predicate();
                    predicade.Items = insertedNodes.ToArray();
                    cmlDelete.where = predicade; // = predicade;
                    cml.delete = new CMLDelete[1];
                    cml.delete[0] = cmlDelete;
                    UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
                   // int size = result.Length;
                }
                catch (Exception e)
                {
                    …..
                }
            }
        }

no exception is thrown but the files are kept on the repo.

What is wrong?

Outcomes