WebDav access denied error when opening a connection to an Excel form

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. 

 

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: