I have an occasion to develop custom SharePoint Online components in Office 365 with Ken Withee, the author of Office 365 for Dummies and a published author of several SharePoint and SQL books (recently, Ken has published Professional Microsoft SQL Server 2011 Reporting Services). One of the features we have developed is a list definition from a custom content type where the same custom content type holds custom fields.
The following steps would provide us a high-level guidance to address the same requirement.
1. Let us start by creating an Empty SharePoint Project in Microsoft Visual Studio 2010. For this demonstration, we will name it SharePointOnlineList.
2. Let us make sure that it should be a sandboxed solution.
3. The first component we are going to create is a custom field. For this, we are going to add an Empty Element in our SharePointOnlineList project. We will name it ListField.
4. On the Elements.xml of our ListField, as illustrated below, let us add a Field Element. I have simply generated the ID using GUID Generator in Microsoft Visual Studio 2010. The same ID will be used in the next component.
5. Now that we have already created in the previous steps a custom field, named Demonstration Field, we will now create a Content Type that inherits SharePoint’s Item Content Type. The same content type will hold the Demonstration Field we have just created. We will name it ListContentType.
6. Let us make sure to select Item as our base content type.
7. On the Elements.xml of our ListContentType, as illustrated below, let us change some property values of our ContentType element and add some FieldRefs. The LinkTitle and Title FieldRefs are SharePoint’s native fields while the DemonstrationField is the one we have created in the previous steps. Let us make sure to have the right FieldRef IDs.
8. The last component we will be creating is a List Definition from the content type we have just created. Let us name it ListDefinition.
9. Let us make sure to use the Demonstration List content type that we have created.
10. For our purpose, let us change some property values in the Elements.xml of the List Instance.
After easily creating our custom ListField, ListContentType, and ListDefinition, let us now package our solution and deploy it to our SharePoint Online site in Office 365.
11. Let us deploy our newly created solution in the Solutions gallery of our SharePoint Online site.
12. And the final step is to activate the SharePoint Online List feature we have just deploy.
13. Now, its time to verify feature we have deployed.
The Demonstration Field under the SharePoint Online Custom Fields group in the Site Columns list.
The Demonstration List under the SharePoint Online Content Types group in Site Content Types list.
And of course, the list we have created.