Configuration: Windows Server 2003 SP2, IIS 6 WebDav enabled ,SharePoint 2007.
An Excel spreadsheet was published to a document library, using the SaveAs function which gets the url for the document library.An event handler was attached to the document library and each time an item was added, the code, which ran with elevated permissions (under the application pool id), tried to open a connection, using a connection string in the form of “Provider=Microsoft.jet.OLEDB.4.0;Data Source=[WebDav network share],Extended Properties=’Excel 8.0;HDR=Yes;Imex=0;”, and failed.The error message was “Failure creating file…” which basically means a connection could not be opened but without specifing the reason for it.WebDav path was correct.Running Process Monitor revealed access denied errors.The app pool id had sufficient permissions to the document library.
We did not solve it but managed to work around it by copying the file to a different location on the disk, before opening a connection to it.
The code that was used for copying uses the Object Model :
byte[] bytes = ItemEventProperties.ListItem.File.OpenBinary();
File.WriteAllBytes(Path.GetTempFileName(),bytes);
Anyone with an idea of what was the actual issue is more than welcome to post it here.
Filed under: Document Library, SharePoint 2007, WebDAV Tagged: | Access Denied, Excel, Failure Creating File, SharePoint 2007, WebDAV