Montag, 14. Oktober 2013

file.OpenBinary() - access denied

I ran over an error, which can be confusing. I wanted to get a file in SharePoint 2010 programmatically and suddenly I received the error at file.OpenBinary(), that the access is denied. I checked all the permission and was even more confused, because everything was set correctly. I was accessing via elevated privilages and this made me wonder even more.
The solution was really simple. The path to the file was wrong. Usually I would expect a file not found error message in SharePoint, but it seems an access denied is thrown in this case.
The path was not wrong in a matter, that the library was not existing, it was more, that the path went deeper in the folder structure than there was any existing in the library.

Keine Kommentare:

Kommentar veröffentlichen