I am trying to upload multiple attachments using Bulk API. I am using createBatchFromDir() for creating the Batch & using the sample code provided in the sfdc documentation at the link:-
https://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_code_walkthrough.htm.
I have replaced the createBatchesFromCSVFile() method with createBatchFromDir().
I am passing the batchContent parameter as
InputStream batchContent = new FileInputStream("C://Temp//TestUploadCases//Attachments//Upload.csv");
Also have set the ContentType param as "ZIP_CSV".
However when I execute the code I am getting the following error:-
BATCH STATUS:
[BatchInfo id=........
jobId=.........
state='Failed'
stateMessage='InvalidBatch : Field name not found : Name'
...
]
[AsyncApiException exceptionCode='InvalidBatch' exceptionMessage='Records not processed' ]
This error occurs while trying to execute the following line in checkResults() method:-
new CSVReader(connection.getBatchResultStream(job.getId(), b.getId()));
Any help to resolve the above error would be very much appreciated.
Thanks.