SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a sandbox solution that deploys an xsl file to the styles library. The solution is scoped to the web and what happens is when the solution is deployed, the xsl file is stilled checked. Now I have a solution to resolve this matter, but is there reason why this happens? I do have Publishing activated on the site collection level.

share|improve this question
up vote 2 down vote accepted

This is standard behavior for sandboxed solutions. I'm glad to hear you already have a fix to ensure your file gets checked in. For those that don't, I've written up a guide on my blog:

To summarize, in the FeatureActivating event handler you will need to loop through each deployed file and check them in and/or approve them depending on the settings of the library.

Check out the post for more details, but here is the basic code I use for all of my files deployed to the Style Library (Runs in the FeatureActivating event handler):

Dim styleLibrary As SPList = topSite.Lists.TryGetList("Style Library")
If styleLibrary IsNot Nothing Then
    Dim folders As SPListItemCollection = styleLibrary.Folders
    Dim item As SPListItem = DirectCast((From i In folders Where DirectCast(i, SPListItem).Url = "Style Library/RICBranding" Select i).FirstOrDefault(), SPListItem)
    ApproveAndPublish(item.Folder, styleLibrary.EnableModeration)
End If

Here is the helper method called above that I use to recursively check in/approve the files in all the subfolders:

Private Sub ApproveAndPublish(folder As SPFolder, Approve As Boolean)
    If folder Is Nothing Then Return
    For Each subfolder As SPFolder In folder.SubFolders
        ApproveAndPublish(subfolder, Approve)
    For Each file As SPFile In folder.Files
        If Not file.CheckOutType = SPFile.SPCheckOutType.None Then
            file.CheckIn("Feature Activation", SPCheckinType.MajorCheckIn)
            If Approve Then
                file.Approve("Feature Activation")
            End If
        End If
End Sub
share|improve this answer

This is a known behaviour for modules in the sandbox.

You should be able to added a Feature reciever on the feature that deploys your module, in that itterate through the target library and publish the list items that match your deplyed xslt files/

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.