2010-07-23 42 views
0

MSDNListInstance QuickLaunchUrl是否工作?

QuickLaunchUrl可選文本。 指定通過快速啓動 導航打開列表的查看頁面的URL爲 。

我再有有效和無效網址的混合物以下元素:

<?xml version="1.0" encoding="utf-8"?> 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
    <ListInstance 
     FeatureId="00BFEA71-D1CE-42de-9C63-A44004CE0104" 
     TemplateType="104" 
     Title="Announcements" 
     Url="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;" 
     QuickLaunchUrl="Lists/Invalid/JunkUrl.php"> 
    </ListInstance> 
    <ListInstance 
     FeatureId="00bfea71-ec85-4903-972d-ebe475780106" 
     TemplateType="106" 
     Title="$Resources:core,calendarList" 
     Url="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder" 
     QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder/AllItems.aspx"> 
    </ListInstance> 
    <ListInstance 
     FeatureId="00bfea71-7e6d-4186-9ba8-c047ac750105" 
     TemplateType="105" 
     Title="$Resources:core,contactsList;" 
     Url="$Resources:core,lists_Folder;/$Resources:core,contacts_Folder;" 
     QuickLaunchUrl="blah blah blah"> 
    </ListInstance> 
    <ListInstance 
     FeatureId="00bfea71-6a49-43fa-b535-d15c05500108" 
     TemplateType="108" 
     Title="Discussions" 
     Url="$Resources:core,lists_Folder;/$Resources:core,discussions_Folder;" 
     QuickLaunchUrl="Lists/Team%20Discussion/Threaded.aspx"> 
    </ListInstance> 
    <!-- Custom Shared Documents --> 
    <ListInstance 
     FeatureId="58c1f9c9-eadb-41dd-a358-e04b2f2e30c0" 
     TemplateType="100316" 
     Title="$Resources:core,shareddocuments_Title;" 
     Url="$Resources:core,shareddocuments_Folder;" 
     QuickLaunchUrl="$Resources:core,shareddocuments_Folder;/Forms/ByCategory.aspx"> 
    </ListInstance> 
    <ListInstance 
     FeatureId="00bfea71-2062-426c-90bf-714c59600103" 
     TemplateType="103" 
     Title="$Resources:core,linksList;" 
     Url="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" 
     QuickLaunchUrl="FALSE"> 
    </ListInstance> 
    <ListInstance 
     FeatureId="00BFEA71-A83E-497E-9BA0-7A5C597D0107" 
     TemplateType="107" 
     Title="$Resources:core,taskList;" 
     Url="$Resources:core,lists_Folder;/$Resources:core,tasks_Folder;" 
     QuickLaunchUrl="Lists/Tasks/active.aspx"> 
    </ListInstance> 
    <ListInstance 
     FeatureId="00BFEA71-C796-4402-9F2F-0EB9A6E71B18" 
     TemplateType="119" 
     Title="Wiki" 
     Url="$Resources:core,WikiWebLibPages_Folder;" 
     QuickLaunchUrl="$Resources:core,WikiWebLibPages_Folder;/Forms/ByAuthor.aspx"> 
    </ListInstance> 
</Elements> 

所有列表出現在快速啓動(甚至是鏈接列表),但即使他們沒有(何時有效)正在使用自定義網址。是什麼賦予了?

回答

0

從我所看到的,不,QuickLaunchUrl不起作用。改用OnQuickLaunch。

使用documentation,我發現下面的代碼Microsoft.SharePoint.SPListInstanceElement:

internal SPList EnsureListExists(SPWeb web) 
{ 
    SPList list = null; 
    try 
    { 
     list = web.Lists[this.Title]; 
    } 
    catch (ArgumentException) 
    { 
     Guid guid; 
     int num; 
     string str; 
     string documentTemplate; 
     SPListTemplate.QuickLaunchOptions off = SPListTemplate.QuickLaunchOptions.Off; 
     if (!string.IsNullOrEmpty(this.TemplateType)) 
     { 
      num = int.Parse(this.TemplateType, NumberFormatInfo.InvariantInfo); 
      str = base.FeatureDefinition.Id.ToString(); 
      documentTemplate = null; 
      if (!string.IsNullOrEmpty(this.FeatureId)) 
      { 
       str = this.FeatureId; 
      } 
      if (!string.IsNullOrEmpty(this.DocumentTemplate)) 
      { 
       documentTemplate = this.DocumentTemplate; 
      } 
      if (SPUtility.StsCompareStrings(this.OnQuickLaunch, "TRUE") || !string.IsNullOrEmpty(this.QuickLaunchUrl)) 
      { 
       off = SPListTemplate.QuickLaunchOptions.On; 
      } 
      guid = web.Lists.Add(this.Title, this.Description, this.Url, str, num, documentTemplate, off); 
      if (!(guid != Guid.Empty)) 
      { 
       return null; 
      } 
      return web.Lists[guid]; 
     } 
     return null; 
    } 
    return list; 
} 

所以把任何值QuickLaunchUrl具有作爲進入TRUE到OnQuickLaunch同樣的效果。但是我找不到任何使用或應用QuickLaunchUrl的實際值的地方。