Through this Apicall I have to insert all files from a Loklen folder into a folder in a specific software. the target folder is created by json. the loop iterates through the files and goes with each process in Apicall, which is designed for this according to the software documentation, but does not move the files to the target folder. when I use request.AddFile and use the parameters, a certain file is moved but not all files. I had to cover some places with a star because of data protection. how should I proceed so that all files in the local folder are moved? Thanks for answers
var files = Directory.EnumerateFiles(@"C:\Users\*******\Documents\*******", "*.*", SearchOption.AllDirectories) .Where(s => s.EndsWith(".jpg") || s.EndsWith(".pdf")); foreach (string i in files) { IRestResponse response3; client = new RestClient("http://***.***.***.*"); client.Authenticator = new HttpBasicAuthenticator("*******", "******"); client.Timeout = -1; request = new RestRequest("/******/api/documents/******/" + folderid, Method.POST); request.AddHeader("content-type", "multipart/form-data"); request.AlwaysMultipartFormData = true; request.AddParameter("Object", "{\r\n \"cabinet\": \"Posteingang\",\r\n \"name\": \"Dokument\",\r\n \"objectTypeId\": \******\",\r\n \"fields\": {\r\n \"Datum\": {\r\n \"internalName\": \"*******\",\r\n \"value\": \"03.03.2021\"\r\n },\r\n \"Typ\": {\r\n \"internalName\": \"feld4\",\r\n \"value\": \"Brief\"\r\n }\r\n }\r\n}"); //request.AddFile("file", ); request.AddFile("file" ); response3 = client.Execute(request); Console.WriteLine(response3.Content);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)