Elczar Adame's Shared Points on SharePoint

Posts tagged ‘List Definition’

Developing Custom List Definition for SharePoint Online in Office 365

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.

Capture 1

2. Let us make sure that it should be a sandboxed solution.

Capture 2

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.

Capture 15

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.

Capture 16

Capture 17

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.

Capture 5

6. Let us make sure to select Item as our base content type.

Capture 6

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.

Capture 7

Capture 18

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.

Capture 8

9. Let us make sure to use the Demonstration List content type that we have created.

Capture 9

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.

Capture 10

Capture 19

11. Let us deploy our newly created solution in the Solutions gallery of our SharePoint Online site.

Capture 11

12. And the final step is to activate the SharePoint Online List feature we have just deploy.

Capture 12

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.

Capture 20

The Demonstration List under the SharePoint Online Content Types group in Site Content Types list.

Capture 21

And of course, the list we have created.

Capture 14


Digg This

Tag Cloud