class GetListItemVersionsParameters
A parameter class for configuring list item version retrieval operations in SharePoint, allowing control over result limits and sort order.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/listitems/versions/get_parameters.py
4 - 13
simple
Purpose
This class encapsulates parameters used when retrieving versions of SharePoint list items. It inherits from ClientValue, which is part of the Office365 REST API framework, and provides a structured way to specify how many versions to retrieve and whether they should be sorted in descending order. This class is typically used as a parameter object when calling SharePoint API methods that fetch list item version history.
Source Code
class GetListItemVersionsParameters(ClientValue):
""""""
def __init__(self, row_limit=None, sort_descending=None):
"""
:param int row_limit:
:param bool sort_descending:
"""
self.RowLimit = row_limit
self.SortDescending = sort_descending
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
row_limit: An integer specifying the maximum number of list item versions to retrieve. If None, no limit is applied and all versions may be returned. This helps control the size of the result set and manage performance when dealing with items that have many versions.
sort_descending: A boolean flag indicating whether versions should be sorted in descending order (True) or ascending order (False). When True, the most recent versions appear first. If None, the default sorting behavior of the API is used.
Return Value
Instantiation returns a GetListItemVersionsParameters object with RowLimit and SortDescending attributes set according to the provided parameters. This object is typically passed to SharePoint API methods that retrieve list item versions, where it is serialized as part of the API request.
Class Interface
Methods
__init__(self, row_limit=None, sort_descending=None)
Purpose: Initializes a new instance of GetListItemVersionsParameters with optional row limit and sort order configuration
Parameters:
row_limit: Optional integer specifying the maximum number of versions to retrievesort_descending: Optional boolean indicating whether to sort versions in descending order
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
RowLimit |
int or None | The maximum number of list item versions to retrieve. None indicates no limit. | instance |
SortDescending |
bool or None | Flag indicating whether versions should be sorted in descending order. None uses default API behavior. | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
from office365.sharepoint.listitems.versions.get_parameters import GetListItemVersionsParameters
# Create parameters to get the 10 most recent versions
params = GetListItemVersionsParameters(row_limit=10, sort_descending=True)
# Access the configured parameters
print(f"Row Limit: {params.RowLimit}")
print(f"Sort Descending: {params.SortDescending}")
# Typically used with SharePoint list item methods:
# list_item.versions.get_by_parameters(params)
Best Practices
- Always specify row_limit when dealing with list items that may have many versions to avoid performance issues and large data transfers
- Set sort_descending=True when you need the most recent versions first, which is the most common use case
- This class is immutable after instantiation - create a new instance if you need different parameters
- The class inherits from ClientValue, which means it will be automatically serialized when used in Office365 API calls
- Both parameters are optional and can be None, allowing flexible configuration based on specific requirements
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class GetListsParameters 77.2% similar
-
class ListItemUpdateParameters 76.1% similar
-
class ListItemDeleteParameters 71.2% similar
-
class ListItemVersionCollectionPosition 68.5% similar
-
class ListItemVersionCollection 67.1% similar