20/رمضان/1433 10: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.
22/رمضان/1433 05:55 صالمشرف
11/شوال/1433 09: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.
13/شوال/1433 09:59 م
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.
Jing Wang | Microsoft Online Community Support
- تم وضع علامة كإجابة بواسطة Emir LiuMicrosoft Contingent Staff, Moderator 16/شوال/1433 02:14 ص