【问题标题】:Disable default fields(column) available in a sharepoint library禁用共享点库中可用的默认字段(列)
【发布时间】:2011-05-13 17:32:19
【问题描述】:

我想禁用允许用户选择在创建共享点库期间可用的不同名称字段(列)的选项。我希望用户创建一个新列,而不是在默认的可用名称列中进行选择。是否可以注入禁用这些功能的脚本?或任何其他解决方法?

文档库是从自定义库模板创建的。这些名称字段应仅对从此特定模板创建的库禁用。

这是一个 Sharepoint 2010 应用程序。

一般如何禁用默认列选项?

任何帮助表示赞赏,谢谢!

【问题讨论】:

    标签: javascript jquery sharepoint-2010 sharepointdocumentlibrary


    【解决方案1】:

    以防万一有人在寻找答案,我发布这个

    URL 是来自 httpContext 的绝对 URL

    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");
                                }
                        }
                    }  
                }
    

    脚本在 documet.getReady 函数中执行类似的操作

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-26
      • 1970-01-01
      • 2013-11-27
      • 2013-11-10
      • 1970-01-01
      • 2014-10-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多