Reading File Contents, Checking Download State, and Downloading Files
Applies to: SharePoint Workspace 2010 | Visual Studio 2008
The ReadFile operation returns the contents of a file, but you can only read the contents of a file that has been downloaded.
In the Files tool user interface, the user has the option of specifying that files in a folder will either be automatically downloaded when another user adds a file or only be downloaded if the user explicitly requests it.
The ReadFile operation in the GrooveFilesBase64 service returns the contents of a file. The FileContents element in the response SOAP message has a type of xs:base64Binary.
The current download state of a file is described in the DownloadState element in the FileDescriptor. If the value is 1, then the file has been downloaded and you can read the contents. If you attempt to read a file that has not been downloaded, the ReadFile operation will return an exception. A file is not downloaded if the DownloadState is 2 (no download has been attempted), 3 (download currently in progress), or 4 (download attempted but failed because of an error).
The following table describes the relationships between the download settings as displayed by the Files tool user interface for a folder and the values in the FileDescriptor elements.
Files tool user interface download settings |
Web service FileDescriptor elements |
---|---|
Full automatic download |
AutoDownload=true DownloadSizeLimit=0 |
Limited automatic download size in MB |
AutoDownload=true DownloadSizeLimit=size in bytes (should be exact multiples of 1 MB) |
Manual download |
AutoDownload=false DownloadSizeLimit=0 |