This is in the context of MOSS 2007.
I have a custom site definition. Currently in ONET.xml we have the following Module:
<View List="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="1" />
You'll notice that this is a site with the publishing features activated and the default.aspx page is provisioned to the Pages library. This correctly provisions the page to the Pages library with an Announcements List View web part provisioned to the page.
I have about 800 (or so) sites created from this site definition. We have a need to add a few web parts to the page for any new sites created from the template and also for all of the existing 800 sites.
The plan was to move the default.aspx module from ONET and into a feature, then reference the feature from ONET. Once this was done, generate a series of stsadm deactivatefeature and activatefeature commands to get the home page the way we needed for all existing sties. New sites would pick it up via the feature.
When I do this I can deactivate and reactivate the feature to correctly replace the home page with the "latest version". However, when I create new sites (for example using Central Admin or through the API using SPWebApplication.Sites.Add()), the site creation fails with a very generic "Cannot complete this action. Please try again." error message. Digging through the 12\Logs, I found a little more detail:
Failed to find a suitable list for tag in module for file 'Pages/default.aspx' given List attribute 'Lists/Announcements'.
If I take the element out of the , things work fine (but this obviously is not what I want). I've tried a number of things, such as replacing the "List='104'", trying with other list types, etc. All with same/similar result.
Do elements work when are provisioned to "Pages" library? Is there an a way to get this to work correctly? Is there a suitable workaround to allow me to configure my site definition to create the correct web parts for existing sites and any new sites?
Well, given enough time, you can figure things out with SharePoint...
Here is what appears to be happening.
In ONET, I also had CAML to provision some lists (here is the Announcements one):
<List FeatureId="00BFEA71-D1CE-42de-9C63-A44004CE0104" Type="104" Title="$Resources:core,announceList;" Url="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;"> <Data> <Rows> <Row> <Field Name="Title">Something</Field> <Field Name="Body">Here</Field> <Field Name="Expires"><ows:TodayISO/></Field> </Row> </Rows> </Data> </List>
I guess that SharePoint must activate all features in ONET's and BEFORE it does anything else in ONET (like provision lists and modules). So, if I had my default.aspx page in it was getting activated BEFORE my list(s) were provisioned. Hence my error message about trying to provision a List View web part using a list that didn't yet exist. I guess this makes sense since you could have a Feature in SiteFeatures or WebFeatures that is needed to make a list, or provision a Module.
Move the List elements from ONET to ListInstance elements in a new feature. I had setup a feature ActivationDependency on my new Pages feature to the new Lists feature, but that resulted in my list data being provisioned on existing items when i reactivated the Pages feature. I stripped the ActivationDependency, and just ensured that Lists feature reference appears before Pages feature reference in ONET.
SharePoint always keeps it interesting!
it to the default.aspx home page. I would be happy either way. Note: I want to be able to activate this on existing site, I dont want to create a new Site Definition. Here is what I have tried: Feature Receiver... Module: I think this is the most likely path forward, however it seems to always want to provision a file to the site. For example, if I want to add a web part to the home page (default.aspx), then there doesn't seem to be a way to just get a reference to the page, it always wants to overwrite it with a new file. But I dont want to do that, I just want to add a Web Part to the existing page. See my
I am using SharePoint 2007 Server x64 on Windows Server 2008 x64. I create a new SharePoint web application with a new site collection at the root of the web application. I select the template "publishing portal" for the site collection. I have also enabled anonymous access. Now the basic function is fine, except that I do not know how to change the first front page (i.e. the page showed to end users who have not logged in yet) of the site. Here is a screen snapshot. Any ideas how to edit this page? Publishing home page http://i33.tinypic.com/2hex08j.png BTW: I have tried to edit
(I have also asked this question on Stack Overflow) I have a SharePoint feature I'm using to add some custom aspx files to the Pages Library. When I activate the feature, I can visit the pages in-browser and they are visible in SPDesigner, but when I "View All Site Content" they are not there. Why is this the case? The Feature's Elements File: <?xml version="1.0" encoding="utf-8"?> <.../Pages/Example.aspx When I "View All Site Content" I am looking at the contents of the "Pages" list: http://myserver:PORT/subsite/Pages/Forms/AllItems.aspx
I have a webpart i build using WSpBuilder and it works OK. When i use Deploy from Visual Studio it installs the WSP sharepoint and add the webpart to the webpart gallery. But it seems the feature does activate the webpart but i also want to remove it when deactivating it.(So i know i need to add something to the FeatureDeactivating So i created a Feature With Reciever template and added... deactivate it it doesn't remove it but i get error: Failed to instantiate file "myStoreComms.webpart" from module "WebPartPopulation": Source path "myStoreComms.webpart" not found. Any ideas.. .what
changes to a site definition to the sites that have been created from it. Changes to web templates only affect new sites that are created from them. My understanding was that this is not the case with site definition schemas (and list definition schemas). I understand that you can only add to a definition once a site has been created from it or the sites will break, but I saw the note on this page...There have been several questions asked on this site regarding the best way to provision sites and lists (definition schemas vs. templates vs. the object model vs. the web interface vs. provisioning
I have a document library using a document set content type. I can create a new document set through the UI and it works perfectly. I'm now trying to create a document set in this library programmatically and it's not working properly. Here is the code (based on MSDN documentation): // Set some properties Hashtable properties = new Hashtable(); properties.Add("UploadComplete", false... for the set looks like a folder instead of the document set icon clicking on the document set doesn't show the document set home page, it just behaves like a normal document library running CAML queries shows
I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise, and I am using publishing portal template. I have created a list in top level site. And I want to use the list in a child site (e.g. adding the list to a page in child site by using Page --> Add Web Parts --> Browse), but can not find the list created in parent site in this way. Any ideas how to use the list (created in parent site) in a child site? BTW: I can use the list (created in parent site) in parent site without any issues.
When you activate Group Work Lists feature in a site you get the resources list and a few other lists. If you had the resources list to a page then you can see the list and you have to add each resource list to the page using the resources link. What I would like to do is have the resources already included on the page when a user visits the site. So if I have 3 Digital cameras, you can see the bookings for those cameras by defualt without having to add each one as a resource. Does anyone know how to do this? Does that clarify the situation any better? I will try and add screenshots
I'm prototyping the best way to dynamically connect web parts at runtime. Essentailly, the application will allow for several disparate application groups to create web parts that will be consumed within the SharePoint front end. All of the web parts will need to automatically detect consumers and providers to create connections at runtime. What we are looking to do is have webparts discover and automatically connect to other compatible webparts. When a user adds the two compatible parts to a page, the parts should be able create the appropriate connections. We have a well defined