/// <summary> /// Apply a policy to a site /// </summary> /// <param name="web">Web to operate on</param> /// <param name="sitePolicy">Policy to apply</param> /// <returns>True if applied, false otherwise</returns> public static bool ApplySitePolicy(this Web web, string sitePolicy) { #if ONPREMISES return(web.ApplySitePolicyImplementation(sitePolicy)); #else return(Task.Run(() => web.ApplySitePolicyImplementation(sitePolicy)).GetAwaiter().GetResult()); #endif }
/// <summary> /// Apply a policy to a site /// </summary> /// <param name="web">Web to operate on</param> /// <param name="sitePolicy">Policy to apply</param> /// <returns>True if applied, false otherwise</returns> public static async Task <bool> ApplySitePolicyAsync(this Web web, string sitePolicy) { await new SynchronizationContextRemover(); return(await web.ApplySitePolicyImplementation(sitePolicy)); }
/// <summary> /// Apply a policy to a site /// </summary> /// <param name="web">Web to operate on</param> /// <param name="sitePolicy">Policy to apply</param> /// <returns>True if applied, false otherwise</returns> public static bool ApplySitePolicy(this Web web, string sitePolicy) { return(Task.Run(() => web.ApplySitePolicyImplementation(sitePolicy)).GetAwaiter().GetResult()); }