Beispiel #1
0
 /// <summary>
 /// Open a site, if it has a site policy applied and is currently closed
 /// </summary>
 /// <param name="web"></param>
 /// <returns>True if site was opened, false otherwise</returns>
 public static bool SetOpenBySitePolicy(this Web web)
 {
     if (web.HasSitePolicyApplied() && IsClosedBySitePolicy(web))
     {
         ProjectPolicy.OpenProject(web.Context, web);
         web.Context.ExecuteQueryRetry();
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        /// <summary>
        /// Open a site, if it has a site policy applied and is currently closed
        /// </summary>
        /// <param name="web"></param>
        /// <returns>True if site was opened, false otherwise</returns>
        private static async Task <bool> SetOpenBySitePolicyImplementation(this Web web)
        {
            if (await web.HasSitePolicyAppliedImplementation() && await web.IsClosedBySitePolicyImplementation())
            {
                ProjectPolicy.OpenProject(web.Context, web);
                await web.Context.ExecuteQueryRetryAsync();

                return(true);
            }
            return(false);
        }
Beispiel #3
0
        private static async Task <bool> SetOpenBySitePolicyImplementation(this Web web)
#endif
        {
#if ONPREMISES
            if (web.HasSitePolicyAppliedImplementation() && IsClosedBySitePolicyImplementation(web))
#else
            if (await web.HasSitePolicyAppliedImplementation() && await web.IsClosedBySitePolicyImplementation())
#endif
            {
                ProjectPolicy.OpenProject(web.Context, web);
#if ONPREMISES
                web.Context.ExecuteQueryRetry();
#else
                await web.Context.ExecuteQueryRetryAsync();
#endif
                return(true);
            }
            return(false);
        }