Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Yes, I've seen that video. What I don't like about it is that he starts with a content type element, and I don't think I should have to do that (I followed the same steps, except with an elements file instead of a content type, and it didn't work). Have you ever successfully deployed a site column in a sandboxed solution just using an elements file? –  Ben Collins Nov 8 '11 at 5:02
    
When you say "except with an elements file instead of a content type", do you mean that you used the Empty Element item template? If you follow the steps in the video and use the Empty Element item template instead of the Content Type item template it should work just fine. –  Rob Windsor Nov 8 '11 at 6:24
    
Just add the elements file to a Feature, it works in Sandboxed. –  Anders Aune Nov 8 '11 at 6:32
    
@RobWindsor: yeah, that's exactly what I did and it didn't work for me. Hrmmm... –  Ben Collins Nov 8 '11 at 6:44
1  
Further, the link that you've interpretted to mean that Site Columns can't be deployed actually says "Fields". I think it's talking about custom field types which, afaik, can't be deployed in Sandbox –  Andy Burns Nov 8 '11 at 8:59

Your Answer

 
discard

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.