class SimpleDataTable
A class representing a data table structure that contains a collection of SimpleDataRow objects, used in SharePoint search operations.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/simple_data_table.py
6 - 17
simple
Purpose
SimpleDataTable is a client-side value object that encapsulates tabular data for SharePoint operations. It inherits from ClientValue and provides a structured way to manage collections of SimpleDataRow objects. This class is primarily used in SharePoint search and data retrieval scenarios where results need to be organized in a table format. The entity_type_name property identifies this object as 'SP.SimpleDataTable' for SharePoint API interactions.
Source Code
class SimpleDataTable(ClientValue):
"""Represents a data table"""
def __init__(self, rows=None):
"""
:param list[SimpleDataRow] rows: The rows in the data table.
"""
self.Rows = ClientValueCollection(SimpleDataRow, rows)
@property
def entity_type_name(self):
return "SP.SimpleDataTable"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
rows: Optional list of SimpleDataRow objects to initialize the data table. Can be None to create an empty table, or a list of SimpleDataRow instances to pre-populate the table. The rows are stored in a ClientValueCollection which provides collection management capabilities.
Return Value
Instantiation returns a SimpleDataTable object with a Rows attribute containing a ClientValueCollection of SimpleDataRow objects. The entity_type_name property returns the string 'SP.SimpleDataTable' identifying the SharePoint entity type.
Class Interface
Methods
__init__(self, rows=None)
Purpose: Initializes a new SimpleDataTable instance with an optional collection of rows
Parameters:
rows: Optional list of SimpleDataRow objects to populate the table. Defaults to None for an empty table.
Returns: None (constructor)
@property entity_type_name(self) -> str
property
Purpose: Returns the SharePoint entity type identifier for this data table
Returns: String 'SP.SimpleDataTable' representing the SharePoint entity type name
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Rows |
ClientValueCollection[SimpleDataRow] | A collection of SimpleDataRow objects representing the rows in the data table. Provides methods for adding, removing, and iterating over rows. | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
from office365.sharepoint.search.simple_data_row import SimpleDataRow
Usage Example
from office365.sharepoint.search.simple_data_table import SimpleDataTable
from office365.sharepoint.search.simple_data_row import SimpleDataRow
# Create an empty data table
table = SimpleDataTable()
# Create a data table with initial rows
row1 = SimpleDataRow()
row2 = SimpleDataRow()
table_with_rows = SimpleDataTable(rows=[row1, row2])
# Access the rows collection
rows_collection = table_with_rows.Rows
# Get the entity type name
entity_type = table.entity_type_name # Returns 'SP.SimpleDataTable'
# Add rows to an existing table
table.Rows.add(SimpleDataRow())
Best Practices
- Initialize with rows parameter if you have data available at construction time to avoid multiple collection operations
- Use the Rows.add() method to add individual rows after instantiation rather than directly manipulating the collection
- The entity_type_name property is read-only and should not be modified as it's used for SharePoint API serialization
- This class is designed to work within the office365 library ecosystem and should be used in conjunction with SharePoint client context
- The Rows attribute is a ClientValueCollection which provides type safety for SimpleDataRow objects
- When passing to SharePoint APIs, the object will be automatically serialized using the entity_type_name identifier
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SimpleDataRow 71.9% similar
-
class SpecialTermResult 57.5% similar
-
class TeamSiteData 54.6% similar
-
class AnalyticsAction 53.8% similar
-
class SPOTenantWebTemplate 53.6% similar