Ghostable vs. GhostableInLibrary – A Lesson on Custom Form Deployment in SharePoint
December 15, 2009 2 Comments
When provisioning files, you have the option to set files as either Ghostable, GhostableInLibrary, or, to not set that value, and keep it unghosted. All that means is can the file be cached at the web front end level, or, is it always served and built from the database. Ayman El-Hattab has a good write-up on this over at his blog here: http://www.sharepoint4arabs.com/AymanElHattab/Lists/Posts/Post.aspx?ID=97
However, what we want to know is how is the file treated during deployment for custom forms?
Let’s take for instance, you’ve created some custom list forms, and need to deploy those out to a site. Let’s call our file CustomForm1.aspx, and let’s tuck this away in a List Instance feature.
Let’s deploy this as “GhostableInLibrary” first, and see what happens…
Look at that, we have a list created from a custom list definition, which is not inheriting from a Document Library, however, if we deploy the form to our list as GhostableInLibrary, we see that the list item count goes up by 1, and, if we view the list contents, there is nothing there. This is obviously not what we want to do!
Now if we re-deploy this as just Ghostable, the list item count stays the same, and we have no “ghost” item in our list, and our custom forms have been properly deployed.
So, with that, I leave you with the lesson learned here – if you need to deploy custom forms to a regular SharePoint list, deploy them as Ghostable, not GhostableInLibrary, otherwise you end up with that “ghost” item in the list.