zondag 13 februari 2011

Friendly URLs for List items

Have you ever noticed that URL's for listitems, like newsitems or posts or not that friendly in SharePoint. In this blog I explain how to improve all that...

zondag 6 februari 2011

Provisioning InfoPath (XSN) forms

Provisioning InfoPath forms with WSP’s can be hard to get right at first.
What we used to do is: put as much as possible in the WSP’s. Add some extra steps in the site-installation manual to manual publish the forms using InfoPath designer.

Provisioning publishing content (like images) in XML

In most of our SharePoint projects we notice that we need to provision at least some publishing content. What we normally do is creating a separate WSP that’s called something like ‘DefaultContent’ or ‘ExampleContent’.

In this WSP we tend to use some images and publish them to the publishingImages –library and some elements.xml files to define the pages itself. In this XML file we describe the basic content for the page, like publishing-html and text fields.

Like:
1 <file name="Page1.aspx" 
2 path="default.aspx" 
3 type="GhostableInLibrary" 
4 url="page1.aspx">
5 <property name="Title" value="My page"/>
6 <property name="PublishingContent" 
7 value="&lt;h1&gt;My page content&lt;/h1&gt;"/>
8 </file>

Looks familiar, right?

Now we would like to set the image we just deployed to the publishingimages library.
What we would like to do is add another property like this:

1 <property name="PublishingPageImage" 
2 value="~SiteCollection/PublishingImages/image1.jpg"/>

Unfortunately we can’t do this, so we used to set the image fields afterwards in the FeatureActivated event. In this event receiver we will check in the images (if we use a sandboxed solution, since this will not happen automatically) and create some ImageFieldValue-objects to set the page fields.