🔍 Code Extractor

class RecycleBinItem

Maturity: 33

Represents a Recycle Bin item in the Recycle Bin of a site or a site collection.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/recyclebin/item.py
Lines:
11 - 70
Complexity:
moderate

Purpose

Represents a Recycle Bin item in the Recycle Bin of a site or a site collection.

Source Code

class RecycleBinItem(Entity):
    """Represents a Recycle Bin item in the Recycle Bin of a site or a site collection."""

    def restore(self):
        """Restores the Recycle Bin item to its original location."""
        qry = ServiceOperationQuery(self, "Restore")
        self.context.add_query(qry)
        return self

    def move_to_second_stage(self):
        """
        Moves the Recycle Bin item from the first-stage Recycle Bin to the second-stage Recycle Bin if the
        SecondStageRecycleBinQuota property on the current web application is not 0. Otherwise, deletes the item.
        """
        qry = ServiceOperationQuery(self, "MoveToSecondStage")
        self.context.add_query(qry)
        return self

    @property
    def id(self):
        """Gets a value that specifies the identifier of the Recycle Bin item."""
        return self.properties.get("Id", None)

    @property
    def size(self):
        # type: () -> Optional[int]
        """Gets a value that specifies the size of the Recycle Bin item in bytes."""
        return self.properties.get("Size", None)

    @property
    def author(self):
        """Gets a value that specifies the user who created the Recycle Bin item."""
        return self.properties.get(
            "Author", User(self.context, ResourcePath("Author", self.resource_path))
        )

    @property
    def deleted_by(self):
        """Gets a value that specifies the user who deleted the Recycle Bin item."""
        return self.properties.get(
            "DeletedBy",
            User(self.context, ResourcePath("DeletedBy", self.resource_path)),
        )

    @property
    def deleted_date(self):
        """Gets a value that specifies when the Recycle Bin item was moved to the Recycle Bin."""
        return self.properties.get("DeletedDate", None)

    def set_property(self, name, value, persist_changes=True):
        super(RecycleBinItem, self).set_property(name, value, persist_changes)
        # fallback: create a new resource path

        if name == "Id":
            if self._resource_path is None:
                self._resource_path = ServiceOperationPath(
                    "GetById", [value], self._parent_collection.resource_path
                )
            else:
                self._resource_path.patch(value)

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

bases: Parameter of type Entity

Return Value

Returns unspecified type

Class Interface

Methods

restore(self)

Purpose: Restores the Recycle Bin item to its original location.

Returns: None

move_to_second_stage(self)

Purpose: Moves the Recycle Bin item from the first-stage Recycle Bin to the second-stage Recycle Bin if the SecondStageRecycleBinQuota property on the current web application is not 0. Otherwise, deletes the item.

Returns: None

id(self) property

Purpose: Gets a value that specifies the identifier of the Recycle Bin item.

Returns: None

size(self) property

Purpose: Gets a value that specifies the size of the Recycle Bin item in bytes.

Returns: None

author(self) property

Purpose: Gets a value that specifies the user who created the Recycle Bin item.

Returns: None

deleted_by(self) property

Purpose: Gets a value that specifies the user who deleted the Recycle Bin item.

Returns: None

deleted_date(self) property

Purpose: Gets a value that specifies when the Recycle Bin item was moved to the Recycle Bin.

Returns: None

set_property(self, name, value, persist_changes)

Purpose: Sets property

Parameters:

  • name: Parameter
  • value: Parameter
  • persist_changes: Parameter

Returns: None

Required Imports

from typing import Optional
from office365.runtime.paths.resource_path import ResourcePath
from office365.runtime.paths.service_operation import ServiceOperationPath
from office365.runtime.paths.v3.entity import EntityPath
from office365.runtime.queries.service_operation import ServiceOperationQuery

Usage Example

# Example usage:
# result = RecycleBinItem(bases)

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class RecycleBinItemCollection 80.6% similar

    Represents a collection of View resources.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/recyclebin/item_collection.py
  • class RecycleBinQueryInformation 67.9% similar

    A data class that encapsulates query parameters for retrieving items from a SharePoint recycle bin, including filtering, sorting, and pagination options.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/recyclebin/query_information.py
  • class List 48.0% similar

    Represents a list on a SharePoint Web site. A container within a SharePoint site that stores list items. A list has a customizable schema that is composed of one or more fields.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/list.py
  • class File 46.6% similar

    Represents a file in a SharePoint Web site that can be a Web Part Page, an item in a document library, or a file in a folder.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/files/file.py
  • class Folder 46.4% similar

    Represents a folder in a SharePoint Web site.

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