Sunday, August 23, 2009

Exploring Content Type & Creating a Custom Content Type with Event Receivers

Before proceeding to create a custom content type, lets first define it.

Content Types, a core concept used throughout the functionality and services offered in Windows SharePoint Services 3.0, are designed to help users organize their SharePoint content in a more meaningful way. A content type is a reusable collection of settings you want to apply to a certain category of content. Content types enable you to manage the metadata and behaviors of a document or item type in a centralized, reusable way.
For example, consider the following two types of documents: software specifications and legal contracts. It is reasonable that you might want to store documents of those two types in the same document library. However, the metadata you would want to gather and store about each of these document types would be very different. In addition, you would most likely want to assign very different workflows to the two types of documents.

So, What is METADATA ???

Metadata is binary information describing your program that is stored either in a common language runtime portable executable (PE) file or in memory. When you compile your code into a PE file, metadata is inserted into one portion of the file, while your code is converted to Microsoft intermediate language (MSIL) and inserted into another portion of the file. Every type and member defined and referenced in a module or assembly is described within metadata. When code is executed, the runtime loads metadata into memory and references it to discover information about your code's classes, members, inheritance, and so on.
Metadata describes every type and member defined in your code in a language-neutral manner. Metadata stores the following information:
Description of the assembly.
Identity (name, version, culture, public key).
The types that are exported.
Other assemblies that this assembly depends on.
Security permissions needed to run.
Description of types.
Name, visibility, base class, and interfaces implemented.
Members (methods, fields, properties, events, nested types).
Attributes.
Additional descriptive elements that modify types and members.

Benefits of Metadata

Metadata is the key to a simpler programming model, eliminating the need for Interface Definition Language (IDL) files, header files, or any external method of component reference. Metadata allows .NET languages to describe themselves automatically in a language-neutral manner, unseen by both the developer and the user. Additionally, metadata is extensible through the use of attributes. Metadata provides the following major benefits:

1. Self-describing files.

2. Language interoperability and easier component-based design.
3. Attributes.

Now, back to content type: A content type can include the following information:
The metadata, or properties, you want to assign to this type. These are represented by columns added to the list or document library when you add the content type.
Custom New, Edit, and Display forms to use with this content type.
Workflows available for items of this content type. These can be defined to start automatically based on a selected event or condition, or through user selection.
For document content types, the document template on which to base documents of this type.
Any information necessary for custom solutions associated with this content type. You can store this information in the content type as one or more XML documents


So, after theory comes the practical part. Now, for How to: Create a Custom Content Type with Event Receivers please go through the following simple step by step document available in the MSDN -

http://msdn.microsoft.com/en-us/library/dd206944.aspx

No comments:

Post a Comment