I m using following code sample to upload multiple files (using sharepoint Object Model, no webservice) in a document library, but some times it throws exception hresult: 0x80020009, with error code -2147352567 and error message is empty (empty string) while file is upload successfully to the document library. And mostly it occurs only first time mean it occurs when uploading first document after that all process goes smoothly no exception occurs after first time occured. If i eat that exception it works fine. Can any one help me to trace the problem, I can't understand why it throws exception while file has been uploaded to document library. I want to know What's the actual reason and what should I do to avoid that problem.
Code: .....
SPFolder folder = web.GetFolder(folderUrl);
foreach(.....)
{
folder.Files.Add(folderUrl + "/" + fileName, file.Data, true);
}