示例#1
0
        public static string GetSettingsUrl(this SPClient.Field field, TreeNode selectedNode)
        {
            // <sitecollection|web>/_layouts/FldEditEx.aspx?field=Instructie
            // <sitecollection|web>/_layouts/FldEdit.aspx?List=%7BCEBB8CB0%2DC088%2D4BEE%2DBF17%2DE6A8CD5F6C9F%7D&Field=Title

            if (selectedNode.Parent.Parent.Tag is SPClient.Site)
            {
                // <sitecollection>/_layouts/15/fldedit.aspx?field=%5FEndDate&Source=%2F%5Flayouts%2F15%2Fmngfield%2Easpx%3FFilter%3DAll%2520Groups

                SPClient.Site site = selectedNode.Parent.Parent.Tag as SPClient.Site;
                return(string.Format("{0}/_layouts/fldedit.aspx?field={1}", site.RootWeb.GetWebUrl(), field.InternalName));
            }
            else if (selectedNode.Parent.Parent.Tag is SPClient.Web)
            {
                // <sitecollection>/<web>/_layouts/15/fldedit.aspx?field=Sub%5Fx0020%5FSite%5Fx0020%5FColumn&Source=%2Fsub%2F%5Flayouts%2F15%2Fmngfield%2Easpx%3FFilter%3DAll%2520Groups

                SPClient.Web web = selectedNode.Parent.Parent.Tag as SPClient.Web;
                return(string.Format("{0}/_layouts/fldedit.aspx?field={1}", web.GetWebUrl(), field.InternalName));
            }
            else if (selectedNode.Parent.Parent.Tag is SPClient.List)
            {
                // <sitecollection>/<web>/_layouts/15/FldEditEx.aspx?List=%7B051E4502%2D504E%2D49C8%2DA815%2DF46BFD61911D%7D&Field=Modified

                SPClient.List list = selectedNode.Parent.Parent.Tag as SPClient.List;
                return(string.Format("{0}/_layouts/FldEditEx.aspx?list={1}&field={2}", list.ParentWeb.GetWebUrl(), list.Id, field.InternalName));
            }
            else
            {
                return(string.Empty);
            }
        }
        public static string GetSettingsUrl(this SPClient.Feature feature, TreeNode selectedNode)
        {
            // Link: <sitecollection|web>/_layouts/ManageFeatures.aspx
            // Link: <sitecollection>/_layouts/ManageFeatures.aspx?Scope=Site

            if (selectedNode.Parent.Parent.Tag is SPClient.Site)
            {
                SPClient.Site site = selectedNode.Parent.Parent.Tag as SPClient.Site;
                return(string.Format("{0}/_layouts/ManageFeatures.aspx?Scope=Site", site.RootWeb.GetWebUrl()));
            }
            else
            {
                SPClient.Web web = selectedNode.Parent.Parent.Tag as SPClient.Web;
                return(string.Format("{0}/_layouts/ManageFeatures.aspx", web.GetWebUrl()));
            }
        }
 public static string GetSiteSettingsUrl(this SPClient.Web web)
 {
     return(web.GetWebUrl() + "/_layouts/settings.aspx");
 }
示例#4
0
        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);
            }
        }
示例#5
0
        public static string GetSettingsUrl(this SPClient.ContentType ct, TreeNode selectedNode)
        {
            // Link: <sitecollection|web>/_layouts/ManageContentType.aspx?ctype=0x0101009148F5A04DDD49CBA7127AADA5FB792B006973ACD696DC4858A76371B2FB2F439A
            // Link: <sitecollection|web>/_layouts/ManageContentType.aspx?List=%7BF798C4D9%2DEF29%2D4F8D%2DA1F1%2D4C70CFBAECE4%7D&ctype=0x010100A204AFB24228A94AB2D6195EB1705291

            if (selectedNode.Parent.Parent.Tag is SPClient.Site)
            {
                SPClient.Site site = selectedNode.Parent.Parent.Tag as SPClient.Site;
                return(string.Format("{0}/_layouts/ManageContentType.aspx?ctype={1}", site.RootWeb.GetWebUrl(), ct.Id));
            }
            else if (selectedNode.Parent.Parent.Tag is SPClient.Web)
            {
                // <sitecollection>/<web>/_layouts/15/ManageContentType.aspx?ctype=0x00A7470EADF4194E2E9ED1031B61DA088403000BE6CEFFF1ACA6429D14B2B7E0A03FE2
                // <sitecollection>/<web>/_layouts/15/start.aspx#/_layouts/15/ManageContentType.aspx?ctype=0x00A7470EADF4194E2E9ED1031B61DA088403000BE6CEFFF1ACA6429D14B2B7E0A03FE2&Source=https%3A%2F%2Fbramdejager%2Esharepoint%2Ecom%2Fsub%2F%5Flayouts%2F15%2Fmngctype%2Easpx

                SPClient.Web web = selectedNode.Parent.Parent.Tag as SPClient.Web;
                return(string.Format("{0}/_layouts/ManageContentType.aspx?ctype={1}", web.GetWebUrl(), ct.Id));
            }
            else if (selectedNode.Parent.Parent.Tag is SPClient.List)
            {
                SPClient.List list = selectedNode.Parent.Parent.Tag as SPClient.List;
                return(string.Format("{0}/_layouts/ManageContentType.aspx?list={1}&ctype={2}", list.ParentWeb.GetWebUrl(), list.Id, ct.Id));
            }
            else
            {
                return(string.Empty);
            }
        }