![](/img/trans.png)
[英]Content Search web part on homepage returns an error when logging in
[英]GetUsageData() in a web part returns null
我試圖在Web部件中顯示一些SharePoint使用情況數據。
這是我的代碼:
SPSite spSiteCollection = new SPSite(myURL)
spSiteCollection.CatchAccessDeniedException = false;
SPWeb spWeb = spSiteCollection.OpenWeb();
DataTable dtResults = new DataTable();
dtResults = spWeb.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);
應該包含結果的DataTable始終為null。 我也嘗試從aspx頁面運行它,但沒有。
我認為在您檢索任何使用數據之前,您必須配置服務器場並激活使用情況報告 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.