Content Types in Visual Studio 2010 in .NET framework

Encode QR Code in .NET framework Content Types in Visual Studio 2010
Content Types in Visual Studio 2010
QR Printer In Visual Studio .NET
Using Barcode generation for VS .NET Control to generate, create QR Code image in .NET applications.
Figure 7-7: SharePoint Customization Wizard
Scan QR In Visual Studio .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in .NET applications.
Figure 7-8: Choosing the base content type in the Wizard
Creating Bar Code In Visual Studio .NET
Using Barcode drawer for .NET framework Control to generate, create bar code image in .NET applications.
7: SharePoint Content Types
Decode Bar Code In Visual Studio .NET
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in .NET framework applications.
Figure 7-9: SharePoint Content Type project structure
Making QR In C#.NET
Using Barcode maker for VS .NET Control to generate, create QR-Code image in Visual Studio .NET applications.
The key item in the content type project is the Elementsxml file This is the file where we are going to define the site columns and all other content type settings The initial contents of the Elementsxml file are shown in Listing 7-1
QR Code 2d Barcode Generation In Visual Studio .NET
Using Barcode generator for ASP.NET Control to generate, create Quick Response Code image in ASP.NET applications.
Listing 7-1: Elementsxml for a Content Type Project Item
QR Code JIS X 0510 Creation In VB.NET
Using Barcode maker for .NET Control to generate, create QR Code image in .NET applications.
       
Generating Bar Code In Visual Studio .NET
Using Barcode creation for Visual Studio .NET Control to generate, create barcode image in .NET applications.
       
Bar Code Drawer In VS .NET
Using Barcode creation for .NET framework Control to generate, create bar code image in Visual Studio .NET applications.
The ContentType element within the Elementsxml file defines a single content type and is prepopulated with values for required and optional attributes Table 7-5 describes the most common attributes used in the ContentType element in the Elementsxml file
UPC A Printer In .NET Framework
Using Barcode generation for VS .NET Control to generate, create UPC-A image in VS .NET applications.
Content Types in Visual Studio 2010
Drawing European Article Number 13 In .NET Framework
Using Barcode generator for .NET framework Control to generate, create EAN 13 image in .NET framework applications.
TABLE 7-5: ContentType Element Attributes
Create USPS Confirm Service Barcode In .NET Framework
Using Barcode encoder for Visual Studio .NET Control to generate, create Planet image in .NET framework applications.
Attribute Name ID
Generate Data Matrix In VB.NET
Using Barcode generator for .NET framework Control to generate, create Data Matrix ECC200 image in .NET framework applications.
Description This attribute specifies the content type ID The ID consists of a parent content type ID, two zeros, and a GUID to uniquely identify the content type The content type name The name of the content type group The content type description Used for field/site column inheritance Content type version number
Bar Code Creation In Visual Basic .NET
Using Barcode printer for .NET Control to generate, create barcode image in .NET applications.
Name Group Description Inherits Version
Generate Barcode In C#.NET
Using Barcode generator for .NET framework Control to generate, create barcode image in .NET framework applications.
At this point, we can actually deploy the content type but this content type wouldn t be very interesting At this point it is identical to its parent in our example, the Picture content type The Picture content type uses site columns specific to pictures, including Date Picture Taken, Picture Size, and Keywords We are going to remove the Date Picture Taken and Picture Size site columns from our new content type so they won t be inherited To remove or add site columns to the content type we can use the FieldRefs element, which was an empty element in Listing 7-1 Add the XML shown in Listing 7-2 to the FieldRefs element in the Elementsxml file
ECC200 Reader In VS .NET
Using Barcode scanner for VS .NET Control to read, scan read, scan image in .NET applications.
Listing 7-2: FieldRefs Element in Elementsxml
Code 128 Code Set C Generator In Java
Using Barcode creator for Java Control to generate, create Code 128 Code Set B image in Java applications.
         
Barcode Printer In Java
Using Barcode creator for Java Control to generate, create bar code image in Java applications.
You are probably wondering where we got the IDs for the two site columns we removed in Listing 7-2 You can use the SharePoint Server Explorer to get the IDs To open the SharePoint Server Explorer, click the Tools menu
Barcode Drawer In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create bar code image in ASP.NET applications.
7: SharePoint Content Types
EAN / UCC - 13 Reader In Visual Studio .NET
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
and select Add SharePoint Connection Next, type the SharePoint site URL and click OK to add the connection to Server Explorer In order to get to the site column name, expand the connection node you just added and under the ContentTypes node, find the desired content type Under each content type you will find the site columns (called fields in this UI) From here, getting to the site column ID is very simple With the site column name selected, open the Properties window and locate the ID property value That s the ID of the site column you want to use when referring to site column in the FieldRefs element Figure 7-10 shows the Server Explorer with the Picture Size site column selected
Figure 7-10: Server Explorer
Before we deploy the solution there is one more thing we need to do we must remove the Inherits attribute because if we don t we won t be able to delete the field references If Inherits is set to TRUE, it will force our content type to have all the same site columns the parent does regardless of our use of RemoveFieldRef elements in Listing 7-2 The final contents of Elementsxml file are shown in Listing 7-3
Content Types in Visual Studio 2010
Listing 7-3: Final ElementsXml for a Content Type That Removes Date Picture Taken and Picture Size from the Base Picture Content Type
       
              
We should deploy the project at this point and verify that the two site columns are not included in the new content type 1 In Visual Studio press F5 to start debugging and deploy the project The Site Content Types page will open in the Internet browser and the deployed content type will be displayed on that page as shown in Figure 7-11