C# API : Unable to find batch with id batchId-xx-xx-xx
Hi everybody,
I'm having trouble uploading files with the Uploader object. Here's how I do it : I have a class dedicated to managing REST operations in which I created the methods.
At instanciation : public TransferFactory(Client client){ uploader = client.Uploader().SetChuncked(true).SetChunkSize(1024); }
Files import :
public void ImportFile(string[] pathes, Document folder) { System.Threading.Tasks.Task.Run(async () => { await uploader.AddFiles(pathes).UploadFiles(); Documents documents = (Documents) await uploader.Operation("FileManager.Import") .SetContext("currentDocument", folder.Path) .Execute(); Console.WriteLine("Done."); }).Wait(); }
When I need to create a folder, (not described here method) it works well. But when I need to upload files, I have the error : C# API : Unable to find batch with id batchId-xx-xx-xx
Any help would be welcome, Thank's in advance !
I finaly found what was going wrong.
The uploader was created once at instanciation and it seems that it disappears during the processing of my program. I guess it's killed for security reason or anything.
So the answer was : Create a new uploader each time the ImportFile method is called.
That's it, thanks for your reflexion.