/// <summary> /// Gets the site closure date /// </summary> /// <param name="web">Web to operate on</param> /// <returns>DateTime value holding the closure date, DateTime.MinValue in case there was no policy applied</returns> public static DateTime GetSiteCloseDate(this Web web) { if (web.HasSitePolicyApplied()) { ClientResult <DateTime> closeDate = ProjectPolicy.GetProjectCloseDate(web.Context, web); web.Context.ExecuteQueryRetry(); return(closeDate.Value); } else { return(DateTime.MinValue); } }
/// <summary> /// Gets the site closure date /// </summary> /// <param name="web">Web to operate on</param> /// <returns>DateTime value holding the closure date, DateTime.MinValue in case there was no policy applied</returns> private static async Task <DateTime> GetSiteCloseDateImplementation(this Web web) { if (await web.HasSitePolicyAppliedImplementation()) { var closeDate = ProjectPolicy.GetProjectCloseDate(web.Context, web); await web.Context.ExecuteQueryRetryAsync(); return(closeDate.Value); } else { return(DateTime.MinValue); } }
private static async Task <DateTime> GetSiteCloseDateImplementation(this Web web) #endif { #if ONPREMISES if (web.HasSitePolicyAppliedImplementation()) #else if (await web.HasSitePolicyAppliedImplementation()) #endif { var closeDate = ProjectPolicy.GetProjectCloseDate(web.Context, web); #if ONPREMISES web.Context.ExecuteQueryRetry(); #else await web.Context.ExecuteQueryRetryAsync(); #endif return(closeDate.Value); } else { return(DateTime.MinValue); } }