}     //ProvisioningOptions

        public TemplateOptions(string title, bool isCreating)
        {
            InitializeComponent();
            _isCreating = isCreating;
            Text        = title;
            string hashText = isCreating ? "Include" : "Apply";
            string atText   = isCreating ? "Persist" : "Apply";
            IEnumerable <GroupBox> groupBoxes = Controls.OfType <GroupBox>();

            foreach (var groupbox in groupBoxes)
            {
                IEnumerable <CheckBox> checkBoxes = groupbox.Controls.OfType <CheckBox>();
                foreach (var checkbox in checkBoxes)
                {
                    checkbox.Text = checkbox.Text.Replace("#", hashText).Replace("@", atText);
                }
            }

            foreach (string item in _contentItems)
            {
                string updatedSting = item.Replace("#", hashText).Replace("@", atText);
                clbContentOptions.Items.Add(updatedSting);
            }

            cbExcludeBaseTemplate.Enabled = isCreating;

            lToolTip.Text = Properties.Resources.ResourceManager.GetString(Constants.Option00);

            _provisioningOptions = new ProvisioningOptions();
        } //TemplateOptions
        public bool CreateProvisioningTemplate(ProvisioningOptions provisioningOptions,
                                               Action <string> writeMessage,
                                               Action <string[]> writeMessageRange)
        {
            object[] args = new object[] { provisioningOptions, writeMessage, writeMessageRange };

            object result = createProvisioningTemplate.Invoke(sharepointObject, args);

            return((bool)result);
        }
Example #3
0
        } //SetStatusDefault

        private void bOptions_Click(object sender, EventArgs e)
        {
            if (_options == null)
            {
                _options = new ProvisioningOptions();
            }

            TemplateOptions templateOptions = new TemplateOptions("Template Apply Options", false);

            templateOptions.ProvisioningOptions = _options;
            DialogResult result = templateOptions.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                _options = templateOptions.ProvisioningOptions;
            }
        } //bOptions_Click
        } //FinishProgressWin

        private bool CreateSPTemplate(Form callee, ProvisioningOptions provisioningOptions)
        {
            SourceWin callForm = callee as SourceWin;
            bool      result   = false;

            callForm.Visible = false;
            provisioningOptions.SharePointVersion = callForm.SelectedVersion;

            string spVersionTitle = EnsureVersionLoaded(provisioningOptions.SharePointVersion);

            ProgressWin progressWin = StartProgressWin(true, spVersionTitle);

            _lbOutput = progressWin.ResultOutput;

            switch (provisioningOptions.SharePointVersion)
            {
            case SharePointVersion.SharePoint_2013_On_Premises:
                result = _sp2013OnPrem.CreateProvisioningTemplate(provisioningOptions, WriteMessage, WriteMessageRange);

                break;

            case SharePointVersion.SharePoint_2016_On_Premises:
                result = _sp2016OnPrem.CreateProvisioningTemplate(provisioningOptions, WriteMessage, WriteMessageRange);

                break;

            case SharePointVersion.SharePoint_2016_OnLine:
                result = _sp2016Online.CreateProvisioningTemplate(provisioningOptions, WriteMessage, WriteMessageRange);

                break;

            default:
                break;
            }

            callForm.Visible = true;

            FinishProgressWin(progressWin);
            return(result);
        } //CreateSPTemplate
Example #5
0
        } //cbNoUNP_CheckedChanged

        private void bApply_Click(object sender, EventArgs e)
        {
            lTemplateError.Visible      = false;
            lSharePointUrlError.Visible = false;
            lUserNameError.Visible      = false;
            lPasswordError.Visible      = false;
            SecureString pwdSecure = new SecureString();

            if (string.IsNullOrWhiteSpace(tbTemplate.Text))
            {
                lTemplateError.Visible = true;
                bBrowse.Focus();
                return;
            }

            if (string.IsNullOrWhiteSpace(tbSharePointUrl.Text))
            {
                lSharePointUrlError.Visible = true;
                tbSharePointUrl.Focus();
                return;
            }

            if (!cbNoUNP.Checked)
            {
                if (string.IsNullOrWhiteSpace(tbUserName.Text))
                {
                    lUserNameError.Visible = true;
                    tbUserName.Focus();
                    return;
                }

                if (string.IsNullOrWhiteSpace(tbPassword.Text))
                {
                    lPasswordError.Visible = true;
                    tbPassword.Focus();
                    return;
                }
            }

            int    slashPosition = tbTemplate.Text.LastIndexOf('\\');
            string path          = tbTemplate.Text.Substring(0, slashPosition);

            slashPosition++;
            string name = tbTemplate.Text.Substring(slashPosition);

            if (_options == null)
            {
                _options = new ProvisioningOptions();
            }

            _options.TemplatePath           = path;
            _options.TemplateName           = name.Replace(".pnp", "");
            _options.WebAddress             = tbSharePointUrl.Text;
            _options.AuthenticationRequired = !cbNoUNP.Checked;
            _options.UserNameOrEmail        = tbUserName.Text;
            _options.UserPassword           = tbPassword.Text;

            Enabled = false;
            ApplyTemplate(this, _options);
            Enabled = true;
        } //bApply_Click