IT tutorials
 
Technology
 

LINQ to SharePoint and SPMetal : Demonstration Scenario (part 4) - Create a Data Structure Using SharePoint 2010 - Associate Content Types , Defining Relationships

11/24/2013 6:14:14 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
2.4 Associate Content Types

The next step is to associate our content types with the lists that we’ve created. Do this:

  1. Highlight the Asset Notes list, and then select List Settings from the ribbon. The list configuration page for the Asset Notes list will appear. You’ll notice a section named Settings with a series of checkboxes, as illustrated. Check the Allow Management Of Content Types checkbox. By default, SharePoint creates simple lists and libraries that are bound to basic system content types, such as Item and Document. Since we want to bind the list to a specific content type, we must configure the list to allow such binding. With this option selected, we are free to add and delete content types as appropriate.

  2. In the Site Objects menu, select Content Types. Then click the Add button. Select and add the Asset Note content type. Then highlight the Item content type select Delete from the ribbon.

  3. Click the Save icon in the title bar to save the changes.

  4. Repeat steps 1–3 for the On-Hire Assets list. This time, add the On-Hire Asset content type instead of the Asset Note content type.

  5. Repeat steps 1–3 for the Hire Contracts document library. This time add the Hire Contract content type.

2.5 Defining Relationships

We now have a template site with each of our three content types bound to a list or library. We could start entering data into these lists. However, one thing that we haven’t considered is the relationships between the various content types. In SharePoint, relationships are defined by using lookup fields. Each lookup field is bound to a particular column in a particular list (although other columns can also be carried through if required). In relational database terms, the lookup field works like a foreign key, holding a value that uniquely identifies a record on the source list.

Note

It is possible to create lookups that can accept multiple values, but for the purposes of defining this data structure, we’re interested only in single value lookups.


Lookup columns target a specific list. While it is possible to include lookup fields in content types, each time the content type is used the lookup field is bound to the list that was set when the content type was created, potentially causing security issues if the list is in a separate site. For that reason, when using lookups to define data structures, you should view them as a constraint to be added on the list, as opposed to a field to contain data within the content type. Adding lookups in a content type greatly reduces the portability of the content type.

Our data structure requires two relationships:

  • On-Hire Asset is related to Hire Contract via ContractId.

  • Asset Note is related to On-Hire Asset via AssetId.

To create these relationships, take the following steps:

  1. In the Site Objects menu, select Lists and Libraries. Highlight the Asset Notes list. Select Edit Columns from the ribbon.

  2. Select Add New Column from the ribbon and then choose Lookup (information already on this site) from the list of options that appears.

  3. In the dialog that appears (shown next), select On-Hire Assets from the List Or Document Library drop-down. In the Field drop-down, select the AssetId. Uncheck the Allow Blank Values checkbox. Click OK to create the new column.

  4. Once the column has been created, right-click the column name and select Rename. Change the column name by typing Asset Reference.

  5. Click the Save button in the title bar to save the changes.

  6. Repeat steps 1–5 for the On-Hire Assets list. This time, bind the lookup column to the Hire Contracts document library and set the field to ContractId. Rename the new field Contract Reference.

2.6 Create a Site Template

We’ve now created a template web site for use by our customers, complete with a data structure that’s logically identical to the relational schema that we defined in Figure 1. The final step that we need to take is to save this site as a template so that we can easily create a new site for each customer as required. To do this, do the following:

  1. From the Site Objects menu, select Blank Site. In the ribbon, select Save as Template.

  2. In the browser window that appears, enter Hire Sample Template in the File Name text box, and then in the Template Name text box, enter Hire Sample Template. Then click OK to create the template.

The new template will be stored in the User Solutions Gallery, where it can be activated and used to create additional sites as required. The solutions gallery is accessible from the root site on any web application. So, for example, if your server is named MyServer and you have a web application running on http://MyServer, then the solutions gallery can be found at http://MyServer/_catalogs/solutions/Forms/AllItems.aspx.

 
Others
 
- LINQ to SharePoint and SPMetal : Demonstration Scenario (part 3) - Create a Data Structure Using SharePoint 2010 - Create Content Types, Create Customer Template Site
- LINQ to SharePoint and SPMetal : Demonstration Scenario (part 2) - Create a Data Structure Using SharePoint 2010 - Create Site Columns
- LINQ to SharePoint and SPMetal : Demonstration Scenario (part 1)
- LINQ to SharePoint and SPMetal : LINQ to SharePoint
- LINQ to SharePoint and SPMetal : Overview of LINQ
- Microsoft Lync Server 2010 : Virtualization Overview (part 3) - Lync Support Guidelines
- Microsoft Lync Server 2010 : Virtualization Overview (part 2) - Benefits of Virtualization, Virtualization Vendors
- Microsoft Lync Server 2010 : Virtualization Overview (part 1) - Hypervisor Types
- Microsoft Lync Server 2010 : UC Endpoints (part 2) - USB Headsets, Speakerphones, and Handsets
- Microsoft Lync Server 2010 : UC Endpoints (part 1) - Standalone IP Phones
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us