תשובה TopNAV using SPXMLDATASOURCE

  • יום רביעי 08 אוגוסט 2012 22:40
     
      קוד כלול

    I'm new to SharePoint and I have created a Custom MasterPage with a dropdown navigation menu via SP designer using ASPMenu and the SPXMLDATASOURCE with the XML file in a library.  My question is I'm now attempting to move this into VS2010 to deploy this as a package for my company.  I can correctly deploy the package and the branding files, but I'm trying to place the branding files in the 14 hive rather than a library to keep the users from easily making changes.  I can get the CSS file to load correctly but I'm having issues getting the SPXmlDataSource to link in the XML file in the 14 hive.  I seem to always get the "Object reference not set to an instance of an object" error and was hoping to get guidance from the community.

    If I set the SpXmlDataSource : DataFileParameters : "FilePath" to a branding folder in the "Style Library" I can get the page to load correctly.  If I change the path to "/_layouts/SP2010Branding/" it always fails.  This is the path that I use to get the CSS file in the header to load correctly.

    <SharePoint:SPXmlDataSource runat="server" id="SPXmlDataSource1" XPath="/siteMap/siteMapNode/siteMapNode">
      <DataFileParameters>
        <asp:parameter DefaultValue="GlobalNAV.xml" Name="FileName"></asp:parameter>
        <asp:parameter DefaultValue="/_layouts/SP2010Branding" Name="FilePath"></asp:parameter>
      </DataFileParameters>
    </SharePoint:SPXmlDataSource>

    Is this possible to have the SpXmlDataSource component reference the /layouts/xxx folder in the 14 hive? This will allow me to have all the site collections/sites reference the same source file.

    Thank you for all comments.

    Dale


    Grumpy

כל התגובות

  • יום שישי 10 אוגוסט 2012 05:55
    מנחה דיון
     
     

    Hi,

    Thank you for your post.
    I'm trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks & Regards,
    Emir


    Emir Liu

    TechNet Community Support

  • יום רביעי 29 אוגוסט 2012 21:04
     
     

    I believe that this SPXMLDATASOURCE can only read from a library if I read the SharePoint 2010 SDK correctly:

    SPXmlDataSource = Represents a data source that is able to read and write XML files from the content database.

    I have move away from the SPXMLDATASOURCE to a CustomNavigationProvider (System.Web.XmlSiteMapProvider) in the web.config file.  This had it's downside of limiting my sitemap file to only 1ea of my URL's.  The request was to have links in several dropdowns to various "popular sites" so I need to find a way to overcome that limitation.  This was supported in the SPXMLDATASOURCE provider.

    If anyone has a better option I would love to hear them.


    Grumpy

  • יום שישי 31 אוגוסט 2012 21:59
     
     תשובה

    Hello Grumpy,
    You are right, the SPXmlDataSource can only link to xml file in Content DB.

    There may be a way to ghost a file like OOB master page, so it is available as regular file in the folder seen by SharePoint Designer but actually stores in File System.

    Or you can restrict the permission for the XML file/Library so normal users cannot change the XML file.

    Regards,
    Jing Wang | Microsoft Online Community Support