Possible Duplicate:
How do I get the filesize from the Microsoft.SharePoint.Client.File object?
I'm connected from WPF application to Office365 using SharePoint Client OM. I want to do that is the file size of attachments.
//SourceCode
Web web = ....
List list = ....
string uri = list.RootFolder.ServerRelativeUrl + "/Attachments/" + id;
Folder attFolder = web.GetFolderByServerRelativeUrl(uri);
FileCollection files = attFolder.Files;
this.Context.Load(files);
this.Context.ExecuteQuery();
foreach(var file in files)
{
//Retrieve file size
}
I tried to measure the size from the length of the stream to get a Microsoft.SharePoint.Client.FileInformation object. but,Length property threw a NotSupportedException.
I considered reading of the Stream object has been abandoned in order to worsen the performance.
FileInformation fileInformation = SP.File.OpenBinaryDirect(this.Context, file.ServerRelativeUrl);
A good way to Retrieve the size of attachments available?