سؤال

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 created from a custom library template. These name fields should be disabled only for libraries created from this particular template.

enter image description here

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;");
 });
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top