能否通过以下方法取得ContentDB的剩余空间, 然后再与Quota中增加的空间比较?
using (SPSite site = new SPSite("site url"))
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "sp_spaceused";
cmd.CommandType = CommandType.StoredProcedure;
SqlConnection sqlConnection = new SqlConnection(site.ContentDatabase.DatabaseConnectionString);
sqlConnection.Open();
cmd.Connection = sqlConnection;
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
string unallocated = reader.GetString(2); // unallocated space
}
}
}