开发者

Does ListInstance QuickLaunchUrl work?

According to MSDN:

QuickLaunchUrl Optional Text. Specifies the URL of the view page to open for the list through Quick Launch navigation.

I then have the following elements with a mixture of valid and invalid URLs:

<?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
        FeatureI开发者_StackOverflow社区d="00BFEA71-C796-4402-9F2F-0EB9A6E71B18"
        TemplateType="119"
        Title="Wiki"
        Url="$Resources:core,WikiWebLibPages_Folder;"
        QuickLaunchUrl="$Resources:core,WikiWebLibPages_Folder;/Forms/ByAuthor.aspx">
  </ListInstance>
</Elements>

All of the lists appear on the Quick Launch (even the Links list), but none of them (even when valid) are using the custom URL. What gives?


From what I can see, no, QuickLaunchUrl does not work. Use OnQuickLaunch instead.

Using the documentation, I found the following code in 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;
}

So putting any value into QuickLaunchUrl has the same effect as entering TRUE into OnQuickLaunch. But I cannot find anywhere that uses or applies the actual value of QuickLaunchUrl.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜