Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top