Sometimes, you need read or write the file, especially the XML file, from the SharePoint Document Library. You can use the Stream or FileStream to read the file directly, otherwise you will get an exception about invalid URL. If you use the XDocument.Load() function to try to get the file, you will get an exception of 401.
If you want to read a file using an application from client, not the server, you can not use the Object Model to read the file. But you can use the WebClient to get the data. And you need set the credential for it.
If you are writing a web part or a event handler, then congratulations to you. You can use the Object Model.
You may have other better methods.
No comments:
Post a Comment