Back in December I posted a lengthy article on how to deploy a Composed Look for SharePoint 2013. If you haven’t read that it can be found here – https://tommdaly.wordpress.com/2012/12/19/deploying-a-custom-composed-look-in-sharepoint-2013/. In that article I described the two methods declarative and imperative. Given all the recent buzz around the deprecated sandbox solutions many of our clients are very anti code for their sandbox and online farms/tenants. I’ll keep this post short and sweet but this expands upon the declarative method.
Going back to my old post, I provided this excerpt of the elements.xml I used to provision the Composed Look to the Composed Looks list. You might wonder how did I get this, well I made a .wsp via Design Manager, renamed it to .cab, and extracted the files. In there I found the elements.xml that was used to deploy the composed look. Using this I was unhappy because if you look closely below you’ll see some URLs in there. I’m not a fan of using URLs or hard coding ANYTHING. If you’ve been working with SharePoint a long time then you know that this is not always possible in their xml with data views, and provisioning. (yes there are hacks & work arounds but lets not go there)
So here is my new snippet of XML for the elements.xml file which is used to create the new list item. I’ve removed the URLs completed and replaced them with ~sitecollection. Alternatively you could use ~site if you just wanted the web URLs to be replaced. No matter what site you upload this to the master page, image, theme, fonts will be connected up properly and no more messy URLs. A few other fields have been cleaned up:
- Removed HyperlinkBarUrl from <ListInstance>
- Removed Description from <ListInstance>
- Display Order Field simplified
- Removed FileLeafRef Field
- Removed ID Field – It will generate the next available, if you set this to 100 then then next available ID becomes 101 when adding another via the UI.
I’ve found that deploying this twice it will NOT overwrite itself. So if you make a change you’ll have to delete the Composed Look via the UI and then redeploy. I don’t see any parameters which allow list rows to be overwritten http://msdn.microsoft.com/en-us/library/ms478860.aspx so this may be a limitation. It would be amazing to be able to overwrite itself for any changes.