Saturday, November 22, 2008

Delete a file from SharePoint

Deleting a file from SharePoint should be fairly easy, i.e. invoking the
SPFile.Delete()
method.

But when invoking this code from a custom web service I get "access denied" error.

Rather than creating my own web service I investigated using standard SharePoint web services. Files can be deleted using web services - as described in the blog where files are deleted from InfoPath.

This MSDN article also describes how to delete files.

Web services are just so much easier to use :-)