siteMapNode Differentiation using "requiredParameters" attribute

Вопрос siteMapNode Differentiation using "requiredParameters" attribute

  • mercredi 2 mai 2012 22:03
     
      A du code

    Hello,

    I built a SharePoint configuration page which can be accessed in three different ways. It's used to configure "Libraries" (any kind), "Content types",  and "Content types" at "List" level (going to Library Settings -> "desired" Content Type -> "My custom feature page").

    The only different between them is the parameters passed. So in the first case the parameter used will be "List", on the 2nd will be "ctype" and the 3th case will use both "List" and "ctype". The resulting Sitemap it's something like this:

    <?xml version="1.0" encoding="utf-8" ?> 
    <siteMap enableLocalization="true">

    <!--Document Library Level Features-->

    <siteMapNode title="$Resources:AdminString,Breadcrumb_Feature_Registration" url="/_layouts/Root_Features.aspx" parentUrl="/_layouts/listedit.aspx" requiredParameters="List"> <siteMapNode url="/_layouts/DocumentNumbering.aspx" title="$Resources:AdminString,Breadcrumb_DocumentNumber_Configuration" /> <siteMapNode url="/_layouts/Lifecycle.aspx" title="$Resources:AdminString,Breadcrumb_Lifecycle_Configuration" /> </siteMapNode> <!--Content Type Level Features--> <siteMapNode title="$Resources:AdminString,Breadcrumb_ContentType_Feature_Registration" url="/_layouts/Root_Features.aspx?Web=1" parentUrl="/_layouts/ManageContentType.aspx?Web=1" requiredParameters="ctype"> <siteMapNode url="/_layouts/DocumentNumbering.aspx?Web=1" title="$Resources:AdminString,Breadcrumb_DocumentNumber_Configuration" /> <siteMapNode url="/_layouts/Lifecycle.aspx?Web=1" title="$Resources:AdminString,Breadcrumb_Lifecycle_Configuration" /> </siteMapNode> <!--List Level Features--> <siteMapNode title="$Resources:AdminString,Breadcrumb_Feature_Registration" url="/_layouts/Root_Features.aspx?List=1" parentUrl="/_layouts/ManageContentType.aspx?List=1" requiredParameters="ctype,List"> <siteMapNode url="/_layouts/DocumentNumbering.aspx?List=1" title="$Resources:AdminString,Breadcrumb_DocumentNumber_Configuration" /> <siteMapNode url="/_layouts/Lifecycle.aspx?List=1" title="$Resources:AdminString,Breadcrumb_Lifecycle_Configuration" /> </siteMapNode>

    </siteMap>

    Problem is, it's not working. The "list level features" configuration somehow overrides the "document level features", so the previous node of "Root_Features.aspx" will point to "ManageContentType.aspx" instead of "listedit.aspx" (as shown in the XML above). This only happens on "Document Library Level Features", the other two are working fine.

    Thanks


Toutes les réponses

  • lundi 7 mai 2012 06:52
    Modérateur
     
     

    Hi johnlouros,

    You should use the attribute of “enableLocalization” in your code like the following.

    <?xml version="1.0" encoding="utf-8" ?> 
    <siteMap enableLocalization="true"> 
     
    <siteMapNode url="/_layouts/MySettingsPage.aspx?List=1" parentUrl="/_layouts/listedit.aspx" title="My Settings" requiredParameters="List" /> 
    </siteMap> 

    Thanks,

    Jack

  • lundi 7 mai 2012 12:55
     
     

    Hi Jack,

    thanks for your response. However my example just highlights the <siteMapNode>'s where the problem exists. The whole sitemap is properly constructed (with xml definition and <siteMap> defined). I will update my example to avoid confusing.

  • mercredi 9 mai 2012 05:11
    Modérateur
     
     

    Hi johnlouros,

    It should not be override your URL. After my search, the other one also can do it. So, when I check your XML file, I find you have the same title in your code, your issue may be caused by the same title.

    <!--Document Library Level Features-->

    <siteMapNode title="$Resources:AdminString,Breadcrumb_Feature_Registration" url="/_layouts/Root_Features.aspx"

    <!--List Level Features-->

    <siteMapNode title="$Resources:AdminString,Breadcrumb_Feature_Registration" url="/_layouts/Root_Features.aspx?List=1"

    You’d better use different title, “ctype,List” and “List”  also in the following link, you can refer to it.

    http://www.gotdotnet.ru/forums/5/126242/

    Thanks,

    Jack

  • mercredi 9 mai 2012 13:41
     
     

    Hi Jack,

    I tried what you suggest, but still no progress. I gave every element a different title, tried to switch ?List=1 from "List level" to "Document level", defined requiredParameters in every child element, and nothing worked...

    I think it's happens because the sitemap "thinks" ctype parameters it defined as null, so that's why when I go to a "Document level feature" page, the site map thinks I am on a "List level feature". But what I want to define is: if ctype parameter doesn't exist in the request URL, it's a "Document level feature" page.

    Check how the request URLs looks like:

    {Document Level Features}   http://localhost/sites/mysite/_layouts/Root_Features.aspx?List={d8c3d9a3-95a6-431c-838e-4d7264201402}
    {Site Content Features}   http://localhost/sites/mysite/_layouts/Root_Features.aspx?ctype=0x010109
    {List Level Features}   http://localhost/sites/mysite/_layouts/Root_Features.aspx?ctype=0x010100801F1D11160F2048A5AF50EB3D7D8719&List=d8c3d9a3-95a6-431c-838e-4d7264201402


    • Modifié johnlouros mercredi 9 mai 2012 13:42
    •