sharepointsharepoint-list

Is it possible to implement inheritance with Sharepoint lists?


Let's say I have a 03 types of sheets list:

Simple sheet, Cool sheet, and Advanced sheet.

Then a Location list. A sheet can have many locations, so the Location list should have a lookup column to the sheet it belongs to. That is the problem.

Normally with regular OOP I would create a base sheet class, let others sheets inherit from it, and use it in the relationship with the Location class.

How can I handle this situation with Sharepoint lists ?


Solution

  • In SharePoint, there isn't a direct way to implement inheritance as you would in traditional object-oriented programming (OOP). However, you can achieve similar functionality through the use of lookup columns and content types.

    Lookup Columns: You can create a Location list that includes a lookup column referencing the Sheet list. This allows you to associate multiple locations with each sheet type (Simple, Cool, Advanced).

    Content Types: You can define different content types for each type of sheet (Simple Sheet, Cool Sheet, Advanced Sheet) that inherit from a base content type. Each content type can have its own specific fields while still sharing common fields defined in the base content type. This way, you can maintain a structured approach similar to inheritance.

    Managing Relationships: When you create the Location list, you can set up a lookup column that points to the base content type or directly to the specific sheet types. This allows you to maintain the relationship between sheets and locations effectively.

    By using these features, you can mimic inheritance and manage relationships between different types of sheets and their associated locations in SharePoint.