class CurrencyInformationCollection
A collection class that holds a list of CurrencyInformation objects representing supported currencies in SharePoint.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/currency_information_collection.py
6 - 10
simple
Purpose
This class serves as a container for managing multiple CurrencyInformation objects. It inherits from ClientValue, making it compatible with SharePoint's client-side object model. The class wraps a ClientValueCollection to provide type-safe storage and manipulation of currency information objects, typically used when working with SharePoint lists that support multiple currencies.
Source Code
class CurrencyInformationCollection(ClientValue):
"""List of supported currencies: contains CurrencyInformation objects."""
def __init__(self, items=None):
self.Items = ClientValueCollection(CurrencyInformation, items)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
items: Optional parameter that accepts an initial collection of CurrencyInformation objects or compatible data to populate the collection. Can be None (default) to create an empty collection, a list of CurrencyInformation objects, or data that can be converted to CurrencyInformation objects.
Return Value
Instantiation returns a CurrencyInformationCollection object with an Items attribute containing a ClientValueCollection of CurrencyInformation objects. The collection can be empty or pre-populated based on the items parameter.
Class Interface
Methods
__init__(self, items=None)
Purpose: Initializes a new CurrencyInformationCollection instance with an optional list of currency items
Parameters:
items: Optional initial collection of CurrencyInformation objects or compatible data. Defaults to None for an empty collection.
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Items |
ClientValueCollection[CurrencyInformation] | A ClientValueCollection instance that stores and manages CurrencyInformation objects. Provides collection operations like iteration, adding, and removing currency information items. | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
from office365.sharepoint.lists.currency_information import CurrencyInformation
Usage Example
from office365.sharepoint.lists.currency_information_collection import CurrencyInformationCollection
from office365.sharepoint.lists.currency_information import CurrencyInformation
# Create an empty collection
currency_collection = CurrencyInformationCollection()
# Create a collection with initial items
initial_currencies = [
CurrencyInformation(),
CurrencyInformation()
]
currency_collection = CurrencyInformationCollection(items=initial_currencies)
# Access the items in the collection
for currency in currency_collection.Items:
# Process each CurrencyInformation object
pass
# Add items to the collection
currency_collection.Items.add(CurrencyInformation())
Best Practices
- Always initialize the collection before accessing the Items attribute to avoid AttributeError
- Use the Items attribute to access the underlying ClientValueCollection for iteration and manipulation
- When passing initial items, ensure they are CurrencyInformation objects or compatible data structures
- This class is typically instantiated by SharePoint API responses rather than manually created
- The collection inherits from ClientValue, so it can be serialized/deserialized for SharePoint API communication
- Do not directly modify the Items attribute; use the collection methods provided by ClientValueCollection (add, remove, etc.)
- This class is immutable in terms of its structure - the Items attribute is set once during initialization
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class CurrencyInformation 76.9% similar
-
class CurrencyList 75.0% similar
-
class ChannelInfoCollection 71.2% similar
-
class FieldCurrency 68.5% similar
-
class CreatableItemInfoCollection 67.7% similar