Is there any way to determine which files stored in my site collection that are the largest? I would like to identify them somehow and then delete them to free up some space.
Thanks for any ideas.
You could use a site data query to find all documents that are bigger than a certain size:
SPWeb web = SPContext.Current.Web;
SPSiteDataQuery query = new SPSiteDataQuery();
// restrict to document libraries
query.Lists = "<Lists ServerTemplate=\"101\" />";
query.ViewFields = "<FieldRef Name=\"File_x0020_Size\" />";
query.RowLimit = 20;
query.Query = "<Where><Geq><FieldRef Name=\"File_x0020_Size\" /><Value Type=\"Number\">{size in bytes}</Value></Geq></Where><OrderBy><FieldRef Name=\"File_x0020_Size\" Ascending=\"FALSE\" /></OrderBy>";
DataTable bigFiles = web.GetSiteData(query);
Query in readable:
<Where>
<Geq>
<FieldRef Name="File_x0020_Size" />
<Value Type="Number">{size in bytes}</Value>
</Geq>
</Where>
<OrderBy>
<FieldRef Name="File_x0020_Size" Ascending="FALSE" />
</OrderBy>