Question

I have created a package in Visual Studio 2010 for SharePoint 2010 which contains a single feature, called "SiteColumns", which link to a single elements file defining a single site column.

I have verified in the feature designer that the elements file is referenced, and I have verified in the package designer that the feature is included, and I am able to deploy, but the site column doesn't appear in the site column gallery.

According to Use Visual Studio 2010 To Create SandBoxed Site with Content, site columns can't be deployed in sandboxed solutions, but according to http://msdn.microsoft.com/en-us/library/gg615463.aspx, they can.

Which is it? And what do I have to do to get it to work?

Update: According to a couple of the commenters below, it appears that declarative xml elements are allowed in sandboxed solutions. So that partially answers the question in one sense. However, I've tried to reproduce the sandboxed feature with a site column as built by Hilton Giesenow shown here. When I used a content type project like he did, it worked as he shows. However, if I start with an empty sharepoint project and add an empty element file (which creates a feature much like he shows in his video), it doesn't work.

I opened up the resulting WSPs and compared the XML. What I found was that the packages were identical with the exception of the GloballyAvailable property set to "True" on the feature built in the content type project like Giesenow did. I added that property to my feature, rebuilt the packages, and compared the resulting XML and found no differences other than feature names/IDs. I redacted some of the naming to keep a client anonymous.

Comparison of WSP files

Now what? Why does one work and not the other?

Update 2: I've migrated the "why doesn't this work" part of this question to a new question and marked an answer for this one, since it's technically answered now. See Why won't my site column deploy from an elements file? for the followup.

Was it helpful?

Solution

Yes, you can include site columns and content types in a sandboxed solution. See How Do I: Create a Site Column in Visual Studio 2010? for a demonstration.

Update (Feb 8, 2017): As the comment by sschoof indicates, the content I linked to in my original answer is no longer available. Please refer to Walkthrough: Create a Site Column, Content Type, and List for SharePoint instead.

Here is a screen capture from that article:

Screen capture from article

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top