I need to get the file size information from a document library in SharePoint 2010 using C# managed CSOM. Any body can give some hint or share sample code?
The following code gets the size of the files in document lib
using (ClientContext oContext = new ClientContext("siteurl"))
{
oContext.Credentials = new NetworkCredential("LoginId", "pwd", "domain");
List oList = oContext.Web.Lists.GetByTitle("DocLib");
CamlQuery oQuery = new CamlQuery();
ListItemCollection collListItem = oList.GetItems(oQuery);
oContext.Load(collListItem);
oContext.ExecuteQuery();
foreach (ListItem oListItem in collListItem)
{
oListItem["File_x0020_Size"]
}
}
Let me know if it helps.