我需要一种简单的方法来获取最新创建的5个站点。获取排名前5位的SharePoint站点,无需循环使用
我知道每个网站都有一个创建日期属性。
我想这样做没有foreach因为可以有1000个子网站。
有什么想法?
using (SPSite clientSiteCollection = new SPSite(currentUrl))
{
foreach (SPWeb web in clientSiteCollection.AllWebs.Select(c => c.Properties["WebTemplate"] == "xx").OrderByDescending(d => d.Created).Take(5))
{
Linq?排序方式创建日期desc并做一个采取5. – Bearcat9425
语法请。 –
添加了下面的语法让我们看看它是如何工作的。 – Bearcat9425