Вопрос

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top