private void OpenPowerShellConsole() { SiteAuth site = Globals.SiteCollections.SingleOrDefault(s => s.Url.OriginalString.Equals(((SPClient.Site)_selectedContextMenuNode.Tag).Url, StringComparison.InvariantCultureIgnoreCase)); string psFile = PowerShellUtil.CreatePowerShellScript(site); System.Diagnostics.Process.Start("powershell.exe", string.Format("-NoExit -File \"{0}\"", psFile)); }
public AddSite(SiteAuth site) { InitializeComponent(); tbSiteUrl.Text = site.UrlAsString; tbUsername.Text = site.Username; tbPassword.Text = site.Password; tbSiteUrl.Enabled = false; cbAuthentication.Enabled = false; if (site.Authentication == AuthN.Default) { cbAuthentication.SelectedIndex = 0; } else { cbAuthentication.SelectedIndex = 1; } if (tbUsername.Text.Length > 0) { tbPassword.Select(); } }
public AddWeb(SiteAuth site) { InitializeComponent(); _site = site; tbSiteUrl.Text = site.UrlAsString; }
private void RemoveSite() { // Remove from global site collection list SiteAuth site = Globals.SiteCollections.SingleOrDefault(s => s.Url.OriginalString.Equals(((SPClient.Site)_selectedContextMenuNode.Tag).Url, StringComparison.InvariantCultureIgnoreCase)); Globals.SiteCollections.Remove(site); // Remove node _selectedContextMenuNode.Remove(); }
public void item_Click(object sender, EventArgs e) { SiteAuth site = Globals.SiteCollections.SingleOrDefault(s => s.UrlAsString.Equals(sender.ToString())); AddSite form = new AddSite(site); DialogResult result = form.ShowDialog(this); if (result == DialogResult.OK) { this.LoadSiteCollections(); } }
private void addSpecificWebToolStripMenuItem_Click(object sender, EventArgs e) { SiteAuth site = Globals.SiteCollections.SingleOrDefault(s => s.UrlAsString.Equals(_selectedContextMenuNode.Text, StringComparison.InvariantCultureIgnoreCase)); AddWeb form = new AddWeb(site); DialogResult result = form.ShowDialog(this); if (result == System.Windows.Forms.DialogResult.OK) { LoadSiteCollections(); } }
public static void LoadSite(TreeNode parentNode, SiteAuth siteAuth, MainBrowser form) { try { SPClient.ClientContext ctx = siteAuth.ClientContext; SPClient.Site site = ctx.Site; ctx.Load(site); ctx.ExecuteQuery(); TreeNode siteNode = parentNode.Nodes.Add(site.Url); siteNode.ImageKey = Constants.IMAGE_SITE; siteNode.SelectedImageKey = Constants.IMAGE_SITE; siteNode.Tag = site; siteNode.ContextMenuStrip = form.mnContextSite; siteNode.Expand(); SPClient.Web rootWeb = site.RootWeb; TreeNode rootWebNode = LoadWeb(siteNode, rootWeb, form); //rootWebNode.Expand(); foreach (string webUrl in siteAuth.Webs) { LoadWeb(siteNode, site.OpenWeb(webUrl), form); } AddLoadingNode(siteNode, "Site Columns", Constants.IMAGE_SITE_COLUMN, LoadType.SiteFields); AddLoadingNode(siteNode, "Content Types", Constants.IMAGE_CONTENT_TYPE, LoadType.SiteContentTypes); AddLoadingNode(siteNode, "Site Features", "Gets a value that specifies the collection of the site collection features for the site collection that contains the site.", Constants.IMAGE_FEATURE, LoadType.SiteFeatures); AddLoadingNode(siteNode, "Recycle Bin", Constants.IMAGE_RECYCLE_BIN, LoadType.SiteRecycleBin); if (!site.Context.IsMinimalServerVersion(ServerVersion.SharePoint2010)) { siteNode.ImageKey = Constants.IMAGE_SITE_WARNING; siteNode.SelectedImageKey = Constants.IMAGE_SITE_WARNING; MessageBox.Show(string.Format("You are NOT connecting to a SharePoint 2010 site ({0}), this could result in errors. Please be aware! The application will continue loading the site as normal.", rootWeb.GetWebUrl()), form.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, form.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }