For one of our projects I created several WebParts as part of a Sandboxed Solution. These WebParts were developed to be used on sites for which ultimately a SiteDefinition needed to be created. Since the WebParts are part of a Sandboxed Solution, my goal was to provision this solution as part of the SiteDefinition to the Solution Gallery located in the RootWeb.

Since the Solution Gallery is just a specialized Document Library in which .wsp Files get placed, I thought using the Module element would help me here. Off course, you could use the Module element inside as a Feature element too, instead of the SiteDefintion I’m using it in. So, first of all I declared my Module element as follows:

<Module Name="Solutions" Path="Solutions" Url="_catalogs/solutions">
    <File Url="HelloSandbox.wsp"/>
</Module>

After creating a new SiteCollection based on the SiteDefinition containing this Module, I navigated to the solution gallery to find my .wsp file there in order to Activate the solution but it wasn’t there. It took me a while to figure out that in order to actually find the .wsp here, I needed to specify the Type within the <File>element with the value “GhostableInLibrary”.

<Module Name="Solutions" Path="Solutions" Url="_catalogs/solutions">
    <File Url="HelloSandbox.wsp" Type="GhostableInLibrary"/>
</Module>

Changing this made the .wsp appear but I wasn’t able to Activate the solution. I was wondering why until I chose to edit the properties of the .wsp and Save the changes without changing anything. After this, I was actually able to activate the solution!

So, editing the properties apparently caused some properties to be set under the hood. In order to figure out which properties, I decided to fire up SharePoint Manager 2010. This is a great tool to get useful insights. It helped me to figure out the following properties were added after editing the .wsp properties:

  • ContentType
  • ContentTypeId
  • SolutionHasAssemblies
  • SolutionHash
  • SolutionId

I decided to (as far as possible) specify the properties listed above one at a time in <Property> elements within the <File> element within the <Module>. By adding them one at a time I was hoping to find the minimum set of properties needed to be set.

I tried the ContentType property first. The value for ContentType (as I could see in SPM2010) was set to “Solution Gallery” so I declared the following <Property> element:

<Property Name="ContentType" Value="Solution Gallery"/>

I then created a new SiteCollection and now I was able to activate the solution! So this one property did the trick! Switching back to SPM2010 showed me that the other 4 properties from the listing above were also set now…

Hope this helps you too!

Categorieën: Nieuws
Tags:

Geef een reactie

Jouw e-mailadres wordt niet gepubliceerd. Verplichte velden zijn gemarkeerd met *

*

De volgende HTML tags en attributen zijn toegestaan: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Categories

  • Tags

  • Blog Authors

    Amy
    anita
    Anneke
    Danny Burlage
    Dennis Vendel
    Freek Berson
    Gerard
    Iris
    Jasper Oosterveld
    Jean-Claude Chan
    Jorn
    Lab Chicks
    Luc Joziasse
    Maarten van Noort
    Maarten Wijsman
    Marlon
    Martijn Bellaard
    Natasja van Doorn
    Paul Pascha
    Peter Heuvelman
    Rick Slager
    Robert van Son
    Roeland Jimenez
    SanderZ
    Sjoerd Schudde
    Stefan van der Wiele
    Tim Heuperman
    Wortell
  • Archief