In my last article about developing SharePoint solutions with CloudShare and Visual Studio 11 Beta, I introduced you to the new, cool list designer. Today I want to show you how it simplifies a lot of the work that goes into designing and deploying custom list definitions and instances either to SharePoint On-Premise or SharePoint Online from a CloudShare SharePoint 2010 development environment.
- As always, you first need to access your CloudShare account and start one of your available environments.
- Once your environment is ready, open VS 11 Beta. Create a new project by clicking on File –> New Project.
- In the “Add New Project” window, go to the SharePoint section under Visual C# project category. Click on the “2010” project templates and select “SharePoint 2010 Project.” Provide a name for the project and the solution and click OK.
- In the “SharePoint Customization Wizard” window, specify your local SharePoint 2010 site for testing purposes. Leave deployment type as “Deploy as a sandboxed solution” and click “Finish.”
- Once the project creation process has completed you will see the complete solution structure in VS 11 Beta Solution Explorer.
- Select the name of the project and right click “Add –> Add New Item.” In the “Add New Item”window, select “Site Column” item template, add a name and click the “Add” button.
- Now a SharePoint Project Item (SPI) for the site column has been added to the VS 11 Beta Solution. The SPI contains the XML definition of a basic site column (TEXT type). We can modify and configure this definition by changing some of the attributes defined in the site column schema. For instance, we can change the site column type, name, or description. Once you have finished site column modifications, save your changes.
- Next we will add a Content Type element to our solution. Select the name of the project in VS 11 Beta, right click “Add–> Add New Item.” In the “Add New Item” window, select the “Content Type” item template, add a name, and press the “Add” button.
- The next window in the SharePoint Customization wizard allows you to choose parent content type to be used as a foundation for our custom content type. SharePoint content types use an inheritance system which means each content type inherits its basic definition from a parent – site columns, workflows, etc. Just select the “item” content type as parent one and press the “Finish” button in the wizard.
- In this case, the content type SPI added to the solution contains a single XML file with its definition. The new improvements here are related to the new Content Type designer that allows you to visually configure your content type. For example, the columns tab in the designer permits you to add existing or custom site columns (contained in current solution) to the content type definition.
- You can always return to the XML view of your content type and check how VS11 Beta is doing the configuration work behind the scenes.
- In the content type designer view we can add the custom site column that was created before and fix it as needed. We can also configure existing site columns inherited from the parent content type.
- After saving the changes you’ve made to content type, you can switch back to XML view and see how VS 11 Beta has added your changes to the content type definition. In this case, references to the site columns have been updated in the definition.
- Now through the visual designer we can configure other content type attributes such as name, description, or visibility.
- As always, once everything is ready, build the complete solution and prepare to publish your solution to the cloud. Right click and select “Publish.”
- In the “Publish” window, specify the URL of the SharePoint OnPremise or SharePoint Online site.
- Once the solution is published, go to the Solutions gallery in your SharePoint site, activate the solution and double check your work:
And that’s how to create and deploy custom site columns and content types using the new list designer included in VS 11 Beta. Happy CloudSharing!