Пример #1
0
        private PropertyBagValue GetIncrementalProvisionModelProperies(List <PropertyBagValue> propertyBagList)
        {
            PropertyBagValue incrementalProvisionModelIdProperty = propertyBagList.FirstOrDefault(currentPropertyValue =>
                                                                                                  currentPropertyValue.Name == "_sys.IncrementalProvision.PersistenceStorageModelId");

            if (Incremental && incrementalProvisionModelIdProperty == null)
            {
                new SystemException("Please set incremental provision model id");
            }
            return(incrementalProvisionModelIdProperty);
        }
Пример #2
0
        /// <summary>
        /// Enables the email recipient override for the specified web application.
        /// When this recipient override is Enabled, all emails send with this helper will only be sent to the specified address clearing all original To, CC, and BCC addresses
        /// and a message will be added to the top of the email body listing the original To, CC, and BCC email addresses.
        /// </summary>
        /// <param name="webApplication">The web application.</param>
        /// <param name="emailAddress">
        /// The email address.
        /// Setting this to an empty string will disable the recipient override.
        /// </param>
        public void EnableRecipientOverride(SPWebApplication webApplication, string emailAddress)
        {
            var uri      = webApplication.AlternateUrls[0].Uri;
            var property = new PropertyBagValue()
            {
                Indexed   = false,
                Key       = RecipientOverridePropertyBagKey,
                Overwrite = true,
                Value     = emailAddress
            };

            this.propertyBagHelper.SetWebApplicationValue(uri, new List <PropertyBagValue>()
            {
                property
            });
        }
Пример #3
0
        private static DefinitionBase EnsurePropKey(this DefinitionBase node, string key, string value)
        {
            var excistringKey = node.PropertyBag.FirstOrDefault(p => p.Name.ToUpper() == key.ToUpper());

            if (excistringKey == null)
            {
                excistringKey = new PropertyBagValue
                {
                    Name = key
                };

                node.PropertyBag.Add(excistringKey);
            }

            excistringKey.Value = value;

            return node;
        }
Пример #4
0
        private static ModelNode EnsurePropKey(this ModelNode node, string key, string value)
        {
            var excistringKey = node.PropertyBag.FirstOrDefault(p => p.Name.ToUpper() == key.ToUpper());

            if (excistringKey == null)
            {
                excistringKey = new PropertyBagValue
                {
                    Name = key
                };

                node.PropertyBag.Add(excistringKey);
            }

            excistringKey.Value = value;

            return(node);
        }
Пример #5
0
        public static DefinitionBase SetPropertyBagValue(this DefinitionBase definition, string name, string value)
        {
            var prop = FindPropertyBagValue(definition, name);

            if (prop == null)
            {
                prop = new PropertyBagValue
                {
                    Name  = name,
                    Value = value
                };

                definition.PropertyBag.Add(prop);
            }

            prop.Value = value;

            return(definition);
        }
Пример #6
0
        internal static void InternalSetPropertyBagValue(List <PropertyBagValue> values,
                                                         string name,
                                                         string value)
        {
            var currentValue = values.FirstOrDefault(p => !string.IsNullOrEmpty(p.Name) &&
                                                     p.Name.ToUpper() == name.ToUpper());

            if (currentValue == null)
            {
                currentValue = new PropertyBagValue
                {
                    Name  = name,
                    Value = value
                };

                values.Add(currentValue);
            }

            currentValue.Value = value;
        }
Пример #7
0
        public void DeploySPMetaModel(SiteModelNode model)
        {
            BeforeDeployModel(x =>
            {
                PropertyBagValue incrementalProvisionModelIdProperty = GetIncrementalProvisionModelProperies(model.PropertyBag);

                Logger("Provisioning preparing model");

                SiteModelNode preparingModel = GetContainersModel(model);

                if (incrementalProvisionModelIdProperty != null)
                {
                    preparingModel.SetIncrementalProvisionModelId("Preparing: " + incrementalProvisionModelIdProperty.Value);
                }

                x.DeployModel(SPMeta2.CSOM.ModelHosts.SiteModelHost.FromClientContext(_ctx), preparingModel);

                Logger("");
                Logger("Provisioning main model");

                x.DeployModel(SPMeta2.CSOM.ModelHosts.SiteModelHost.FromClientContext(_ctx), model);
            });
        }
Пример #8
0
        public static void DeploySPMetaModel(this ClientContext Ctx, SiteModelNode model, bool Incremental)
        {
            BeforeDeployModel(Incremental, x =>
            {
                PropertyBagValue incrementalProvisionModelIdProperty = model.PropertyBag.FirstOrDefault(currentPropertyValue =>
                                                                                                        currentPropertyValue.Name == "_sys.IncrementalProvision.PersistenceStorageModelId");
                if (Incremental && incrementalProvisionModelIdProperty == null)
                {
                    new SystemException("Please set incremental provision model id");
                }

                Console.WriteLine("Provisioning preparing model");
                var preparingModel = model.GetContainersModel();
                if (incrementalProvisionModelIdProperty != null)
                {
                    preparingModel.SetIncrementalProvisionModelId("Preparing: " + incrementalProvisionModelIdProperty.Value);
                }
                x.DeployModel(SPMeta2.CSOM.ModelHosts.SiteModelHost.FromClientContext(Ctx), preparingModel);
                Console.WriteLine();

                Console.WriteLine("Provisioning main model");
                x.DeployModel(SPMeta2.CSOM.ModelHosts.SiteModelHost.FromClientContext(Ctx), model);
            });
        }