1

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?

Community
  • 1
  • 1
user834964
  • 103
  • 1
  • 1
  • 7
  • 1
    Similar thread with solution is over here - http://stackoverflow.com/questions/8339483/how-do-i-get-the-filesize-from-the-microsoft-sharepoint-client-file-object – Nitin Rastogi Dec 09 '11 at 06:14

0 Answers0