SharePoint Site Accessed users list
foreach (SPWeb web in siteCol.AllWebs)
{
DataTable dtUsers = new DataTable();
dtUsers = web.GetUsageData(SPUsageReportType.user, SPUsagePeriodType.lastMonth, 400, DateTime.Now);
if (dtUsers != null)
{
foreach (DataRow rows in dtUsers.Rows)
{
Allrecords.Add(rows["User"] + "|" + rows["Most Recent Day"] + "|" + web.Url);
//Most Recent Day
// Console.WriteLine(rows["User"] + "|" + rows["Most Recent Day"]);
}
foreach (DataColumn col in dtUsers.Columns)
{
Console.WriteLine(col.ColumnName);
}
}
else
{
Console.WriteLine(web.Url);
}
}
No comments:
Post a Comment