🔍 Code Extractor

class BaseItem

Maturity: 34

The baseItem resource is an abstract resource that contains a auth set of properties shared among several other resources types

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/base_item.py
Lines:
10 - 111
Complexity:
moderate

Purpose

The baseItem resource is an abstract resource that contains a auth set of properties shared among several other resources types

Source Code

class BaseItem(Entity):
    """The baseItem resource is an abstract resource that contains a auth set of properties shared among several
    other resources types"""

    @property
    def etag(self):
        # type: () -> Optional[str]
        """ETag for the item."""
        return self.properties.get("eTag", None)

    @property
    def created_by(self):
        # type: () -> IdentitySet
        """Identity of the user, device, or application which created the item."""
        return self.properties.get("createdBy", IdentitySet())

    @property
    def created_by_user(self):
        """Identity of the user who created the item"""
        from office365.directory.users.user import User

        return self.properties.get(
            "createdByUser",
            User(self.context, ResourcePath("createdByUser", self.resource_path)),
        )

    @property
    def last_modified_by(self):
        # type: () -> IdentitySet
        """Identity of the user, device, and application which last modified the item."""
        return self.properties.get("lastModifiedBy", IdentitySet())

    @property
    def last_modified_by_user(self):
        """Identity of the user who last modified the item."""
        from office365.directory.users.user import User

        return self.properties.get(
            "lastModifiedByUser",
            User(self.context, ResourcePath("lastModifiedByUser", self.resource_path)),
        )

    @property
    def created_datetime(self):
        # type: () -> Optional[datetime]
        """Gets date and time of item creation."""
        return self.properties.get("createdDateTime", datetime.min)

    @property
    def last_modified_datetime(self):
        # type: () -> Optional[datetime]
        """Gets date and time the item was last modified."""
        return self.properties.get("lastModifiedDateTime", datetime.min)

    @property
    def name(self):
        # type: () -> Optional[str]
        """Gets the name of the item."""
        return self.properties.get("name", None)

    @name.setter
    def name(self, value):
        # type: (str) -> None
        """Sets the name of the item."""
        self.set_property("name", value)

    @property
    def description(self):
        # type: () -> Optional[str]
        """Provides a user-visible description of the item."""
        return self.properties.get("description", None)

    @description.setter
    def description(self, value):
        # type: (str) -> None
        self.set_property("description", value)

    @property
    def web_url(self):
        # type: () -> Optional[str]
        """URL that displays the resource in the browser"""
        return self.properties.get("webUrl", None)

    @property
    def parent_reference(self):
        # type: () -> ItemReference
        """Parent information, if the item has a parent."""
        return self.properties.setdefault("parentReference", ItemReference())

    def get_property(self, name, default_value=None):
        if default_value is None:
            property_mapping = {
                "createdBy": self.created_by,
                "createdByUser": self.created_by_user,
                "createdDateTime": self.created_datetime,
                "lastModifiedDateTime": self.last_modified_datetime,
                "lastModifiedBy": self.last_modified_by,
                "lastModifiedByUser": self.last_modified_by_user,
                "parentReference": self.parent_reference,
            }
            default_value = property_mapping.get(name, None)
        return super(BaseItem, self).get_property(name, default_value)

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

bases: Parameter of type Entity

Return Value

Returns unspecified type

Class Interface

Methods

etag(self) property

Purpose: ETag for the item.

Returns: None

created_by(self) property

Purpose: Identity of the user, device, or application which created the item.

Returns: None

created_by_user(self) property

Purpose: Identity of the user who created the item

Returns: None

last_modified_by(self) property

Purpose: Identity of the user, device, and application which last modified the item.

Returns: None

last_modified_by_user(self) property

Purpose: Identity of the user who last modified the item.

Returns: None

created_datetime(self) property

Purpose: Gets date and time of item creation.

Returns: None

last_modified_datetime(self) property

Purpose: Gets date and time the item was last modified.

Returns: None

name(self) property

Purpose: Gets the name of the item.

Returns: None

name(self, value)

Purpose: Sets the name of the item.

Parameters:

  • value: Parameter

Returns: None

description(self) property

Purpose: Provides a user-visible description of the item.

Returns: None

description(self, value)

Purpose: Performs description

Parameters:

  • value: Parameter

Returns: None

web_url(self) property

Purpose: URL that displays the resource in the browser

Returns: None

parent_reference(self) property

Purpose: Parent information, if the item has a parent.

Returns: None

get_property(self, name, default_value)

Purpose: Retrieves property

Parameters:

  • name: Parameter
  • default_value: Parameter

Returns: None

Required Imports

from datetime import datetime
from typing import Optional
from office365.directory.permissions.identity_set import IdentitySet
from office365.entity import Entity
from office365.onedrive.listitems.item_reference import ItemReference

Usage Example

# Example usage:
# result = BaseItem(bases)

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Entity_v1 53.5% similar

    Base entity

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/entity.py
  • class TaxonomyItem 53.0% similar

    TaxonomyItem is a base class representing an item in a SharePoint TermStore with a unique identifier, name, and metadata about creation and modification times.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/taxonomy/item.py
  • class OutlookItem 50.8% similar

    OutlookItem is a base class representing a Microsoft Outlook item entity with common properties like change tracking, categories, and timestamps.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/item.py
  • class UserInfoItem 48.9% similar

    UserInfoItem is a specialized SharePoint list item class that represents a user information item, inheriting all functionality from the ListItem base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/listitems/user_info_item.py
  • class BaseCustomProperty 48.5% similar

    BaseCustomProperty is a SharePoint entity class representing a base custom property in the SharePoint Publishing REST API.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/publishing/customproperties/base.py
← Back to Browse