Ejemplo n.º 1
0
        /// <summary>
        /// Helper method for reading branding settings from the Infrastructural Site Collection
        /// </summary>
        /// <returns></returns>
        public static BrandingSettings GetTenantBrandingSettings()
        {
            // Get the current settings from the Infrastructural Site Collection
            var jsonBrandingSettings = PnPPartnerPackUtilities.GetPropertyBagValueFromInfrastructure(
                PnPPartnerPackConstants.PropertyBag_Branding);

            // Read the current branding settings, if any
            var branding = jsonBrandingSettings != null?
                           JsonConvert.DeserializeObject <BrandingSettings>(jsonBrandingSettings) :
                               new BrandingSettings();

            return(branding);
        }
Ejemplo n.º 2
0
        public static SiteCollectionSettings GetSiteCollectionSettings(String siteCollectionUri)
        {
            SiteCollectionSettings result = new SiteCollectionSettings();

            using (var context = PnPPartnerPackContextProvider.GetAppOnlyClientContext(siteCollectionUri))
            {
                Web web = context.Web;
                context.Load(web, w => w.Title, w => w.Url);
                context.ExecuteQuery();

                result.Title = web.Title;
                result.Url   = web.Url;
                result.PnPPartnerPackEnabled = PnPPartnerPackUtilities.IsPartnerPackOverridesEnabledOnSite(siteCollectionUri);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public static void EnablePartnerPackInfrastructureOnSite(String siteUrl)
        {
            siteUrl = PnPPartnerPackUtilities.GetSiteCollectionRootUrl(siteUrl);

            using (var context = PnPPartnerPackContextProvider.GetAppOnlyClientContext(siteUrl))
            {
                try
                {
                    // Try to reference the target library
                    List templatesLibrary = context.Web.Lists.GetByTitle(
                        PnPPartnerPackConstants.PnPProvisioningTemplates);
                    context.Load(templatesLibrary);
                    context.ExecuteQuery();
                }
                catch (ServerException)
                {
                    ApplyProvisioningTemplateToSite(context,
                                                    PnPPartnerPackSettings.InfrastructureSiteUrl,
                                                    "Infrastructure",
                                                    "PnP-Partner-Pack-Infrastructure-Templates.xml");
                }
            }
        }