Today I came across and an issue setting the Preview Image for the Custom Site Template in SharePoint 2010 using Sandbox solution.
I have used the Team site template and given the Icon image in ImageURL in Elements.xml file. As its sandbox I am storing the image file inside the site collection Styles Library. My question is how to give the relative URL for the image url which is present in Site Collection Styles Library.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<WebTemplate BaseConfigurationID="0"
BaseTemplateID="1"
BaseTemplateName="STS"
Subweb="FALSE"
Name="WTTeamSite"
Title="Team site"
Description="Create a Team site"
ImageUrl="/Style Library/img/site-icon.png"
DisplayCategory="Custom" />
</Elements>
If I give full url eg: http://wsdl:3333/sites/Corporate/Styles Library/img/site-icon.png
it works.
But If I give relative URL like [../../Styles Library/img/site-icon.png]
or [../Styles Library/img/site-icon.png] or [~sitecollection/Styles Library/img/site-icon.png] or [Styles Library/img/site-icon.png] or [/Styles Library/img/site-icon.png] doesn't work. How to make this preview image work using relative URL.
Note: I cant use layouts folder as it has to be sandbox solution. Thanks.