开发者

Disable default fields(column) available in a sharepoint library

开发者 https://www.devze.com 2023-03-05 13:26 出处:网络
I want to disable the option that allows users to select the different name fields(columns) available during a sharepoint library creation. I want the users to create a new column instead of chosing a

I want to disable the option that allows users to select the different name fields(columns) available during a sharepoint library creation. I want the users to create a new column instead of chosing among the default available name columns. Is it possible to inject a script that disables these functions? or any other work arounds?

The document library is c开发者_JS百科reated from a custom library template. These name fields should be disabled only for libraries created from this particular template.

Disable default fields(column) available in a sharepoint library

This is a Sharepoint 2010 app.

In general how to disable a default column option?

Any help appreciated, Thanks!


Just in case some one is looking for an answer, am posting this

The URL is the absolute URL from httpContext

if (url.Contains(@"/_layouts/ViewEdit.aspx"))
            {
                sb.AppendLine("Name Field script injection");
                using (SPSite site = new SPSite(url))
                {
                    sb.AppendLine("Site URL : " + site.Url);
                    using (SPWeb web = site.OpenWeb("/"))
                    {
                        sb.AppendLine("Web URL : " + web.Url);

                            string[] urls = url.Split('/');

                            sb.AppendLine("List Name:" + urls[urls.Length - 3]);

                            SPDocumentLibrary library = web.Lists[urls[urls.Length - 3]] as SPDocumentLibrary;
                            SPContentType contentType = library.ContentTypes["Document_Content_type"];

                            if (contentType != null)
                            {
                                sb.AppendLine("Content Type Name:" + contentType.Name);
                                InjectNameColumnScript();
                                sb.AppendLine("Name Column Script has been injected");
                            }
                    }
                }  
            }

The script does something like this inside documet.getReady function

$(document).ready(function() {
   $("#check box_ID").closest("td").parent().attr("style","display:none;");
 });
0

精彩评论

暂无评论...
验证码 换一张
取 消