Forum Discussion

Erik Hjalmarsson's avatar
Erik Hjalmarsson
Copper Contributor
Jan 03, 2017

Tenant.GetSiteProperties doesn't return storage used anymore

We've been using a scheduled job to get some statistics out of our SPO sites for over a year and one thing we've been using is the Tenant.GetSiteProperties(https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.tenant.getsiteproperties.aspx) to return data about the sites. From this method we've saved data from the property StorageUsage on SiteProperties class (https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.storageusage.aspx). But starting in December it seems like this property is returning 0 for every object. Anyone else experienced this?

  • I was having the same problem and just figured out that by using tenant.GetSitePropertiesFromSharePoint, I can get the Storage Usage. However, I don't see the WebCount property being filled up, but I didn't paid much attention to it since I was trying to get the Usage.

    • Arin Roy's avatar
      Arin Roy
      Brass Contributor

      It is very strange behavior that StorageUsed is suddenly 0 for Tenant.GetSiteProperties() but it is available for Tenant.GetSitePropertiesFromSharePoint(). On MSDN there is no clear distiction beween the 2 methods. And it is also not very clear based on the naming of the functions. Strange that things change but there is hardly any documentation to be found. It is all trial and error at the moment.

      • Arin Roy's avatar
        Arin Roy
        Brass Contributor

        So, now I modified my scripts to use the new GetSitePropertiesFromSharePoint() method. And....it seems like a very poorly implemented method. It times out 9 out of 10 attempts made to fetch site properties. And when it does, the collection is almost 1500 site collections (GetSiteProperties does/did around 300 if I'm not mistaken). Why have an implementation to try and fetch 1500 records and timeout most of the time? Anyone have any better luck with GetSitePropertiesFromSharePoint().

         

        Note: Noticed that PNP libraries have been updated to use GetSitePropertiesFromSharePoint() with pull reuqests stating the GetSitePropertiies() will be deprecated. 

Resources