🔍 Code Extractor

class LinkedResource

Maturity: 50

Represents a linked resource item from a partner application that is related to a Microsoft To-Do task, storing information about the source application and enabling linking back to the related item.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/todo/linked_resource.py
Lines:
6 - 22
Complexity:
simple

Purpose

The LinkedResource class models a connection between a todoTask and an item in an external partner application (such as an email). It stores metadata about the source application and the linked item, allowing users to navigate back to the original source. This is useful for tracking task origins and maintaining context between Microsoft To-Do and other applications. The class provides read-only access to the application name and display name of the linked resource through property accessors.

Source Code

class LinkedResource(Entity):
    """Represents an item in a partner application related to a todoTask. An example is an email from where the task
    was created. A linkedResource object stores information about that source application, and lets you link back to
    the related item. You can see the linkedResource in the task details view, as shown.
    """

    @property
    def application_name(self):
        # type: () -> Optional[str]
        """Field indicating the app name of the source that is sending the linkedResource."""
        return self.properties.get("applicationName", None)

    @property
    def display_name(self):
        # type: () -> Optional[str]
        """The title of the linkedResource."""
        return self.properties.get("displayName", None)

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

bases: Inherits from Entity class, which likely provides base functionality for Microsoft Graph API entities including property storage and management

Return Value

Instantiation returns a LinkedResource object that represents a linked item from a partner application. The properties return Optional[str] values: application_name returns the name of the source application or None if not set, and display_name returns the title of the linked resource or None if not set.

Class Interface

Methods

@property application_name(self) -> Optional[str] property

Purpose: Returns the name of the source application that sent the linkedResource

Returns: Optional[str] - The application name as a string, or None if not set

@property display_name(self) -> Optional[str] property

Purpose: Returns the title/display name of the linkedResource

Returns: Optional[str] - The display name/title as a string, or None if not set

Attributes

Name Type Description Scope
properties dict Inherited from Entity base class, stores the underlying property data including applicationName and displayName keys instance

Dependencies

  • typing
  • office365

Required Imports

from typing import Optional
from office365.entity import Entity
from office365.onedrive.linked_resource import LinkedResource

Usage Example

# Assuming you have a todoTask object from Microsoft Graph API
from office365.onedrive.linked_resource import LinkedResource

# LinkedResource objects are typically retrieved from a todoTask
# rather than instantiated directly
# Example: accessing linked resources from a task
task = get_todo_task()  # hypothetical function to get a task
linked_resources = task.linked_resources  # get linked resources collection

for resource in linked_resources:
    # Access the application name
    app_name = resource.application_name
    print(f"Source application: {app_name}")
    
    # Access the display name/title
    title = resource.display_name
    print(f"Resource title: {title}")
    
    # Check if properties exist
    if resource.application_name:
        print(f"This resource came from {resource.application_name}")

Best Practices

  • LinkedResource objects are typically retrieved from the Microsoft Graph API rather than instantiated directly by users
  • The properties are read-only and return None if the underlying data is not available, so always check for None before using the values
  • This class inherits from Entity, which likely manages the internal properties dictionary - avoid directly modifying the properties dictionary
  • LinkedResource objects are meant to be used in the context of todoTask objects and represent external application links
  • The class provides a view into data managed by the Microsoft Graph API, so changes to properties would need to be made through the API, not by modifying the object directly
  • Always handle Optional return types appropriately by checking for None values before using the data

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class TodoTask 63.6% similar

    TodoTask is an Entity subclass representing a task item that can be tracked and completed, with support for extensions, checklist items, and linked resources.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/todo/tasks/task.py
  • class TodoTaskList 62.8% similar

    A class representing a task list in Microsoft To Do that contains todoTask resources and extensions, inheriting from Entity base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/todo/tasks/list.py
  • class ResourceReference 58.7% similar

    A data class representing a reference to a Microsoft Graph resource, containing identifier, type, and URL properties for Office Graph Insights.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/insights/resource_reference.py
  • class Todo 57.8% similar

    Represents the To Do services available to a user, providing access to their task lists through the Microsoft 365 API.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/todo/todo.py
  • class PlannerTask 53.2% similar

    Represents a Microsoft 365 Planner task entity with properties for title and detailed task information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/tasks/task.py
← Back to Browse