Beispiel #1
0
        public NewWebProperties(SP.WebTemplateCollection webTemplates)
        {
            WebTemplate = new List <SelectListItem>();

            foreach (var template in webTemplates)
            {
                WebTemplate.Add(new SelectListItem {
                    Value = template.Name, Text = template.Title
                });
            }
        }
Beispiel #2
0
        public static void LoadWebTemplates(TreeNode parentNode, SPClient.WebTemplateCollection webTemplates, MainBrowser form, LoadType loadType)
        {
            try
            {
                SPClient.ClientContext ctx = GetClientContext(parentNode);
                ctx.Load(webTemplates);
                ctx.ExecuteQuery();

                int total   = webTemplates.Count;
                int current = 0;

                foreach (var template in webTemplates)
                {
                    TreeNode node = parentNode.Nodes.Add(string.Format("{0} ({1})", template.Title, template.Name));
                    node.ImageKey         = Constants.IMAGE_WEB_TEMPLATES;
                    node.SelectedImageKey = Constants.IMAGE_WEB_TEMPLATES;
                    node.Tag = template;
                    node.ContextMenuStrip = form.mnContextItem;

                    if (template.IsHidden)
                    {
                        node.ForeColor = Color.Gray;
                    }

                    // Update progress
                    current++;
                    ItemLoaded(null, new ItemLoadedEventArgs()
                    {
                        TotalItem = total, CurrentItem = current
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, form.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                AddLoadingNode(parentNode, loadType);
            }
        }