Esempio n. 1
0
 /// <summary>
 /// Gets the site expiration date
 /// </summary>
 /// <param name="web">Web to operate on</param>
 /// <returns>DateTime value holding the expiration date, DateTime.MinValue in case there was no policy applied</returns>
 public static DateTime GetSiteExpirationDate(this Web web)
 {
     if (web.HasSitePolicyApplied())
     {
         ClientResult <DateTime> expirationDate = ProjectPolicy.GetProjectExpirationDate(web.Context, web);
         web.Context.ExecuteQueryRetry();
         return(expirationDate.Value);
     }
     else
     {
         return(DateTime.MinValue);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Gets the site expiration date
        /// </summary>
        /// <param name="web">Web to operate on</param>
        /// <returns>DateTime value holding the expiration date, DateTime.MinValue in case there was no policy applied</returns>
        private static async Task <DateTime> GetSiteExpirationDateImplementation(this Web web)
        {
            if (await web.HasSitePolicyAppliedImplementation())
            {
                var expirationDate = ProjectPolicy.GetProjectExpirationDate(web.Context, web);
                await web.Context.ExecuteQueryRetryAsync();

                return(expirationDate.Value);
            }
            else
            {
                return(DateTime.MinValue);
            }
        }