🔍 Code Extractor

class TaxonomyMetadata

Maturity: 34

A client value class representing taxonomy metadata for SharePoint Publishing, specifically storing an anchor ID reference.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/taxonomy/metadata.py
Lines:
4 - 13
Complexity:
simple

Purpose

TaxonomyMetadata is a data transfer object (DTO) that encapsulates taxonomy-related metadata for SharePoint Publishing operations. It inherits from ClientValue, making it suitable for serialization and transmission in SharePoint API calls. The class primarily stores an anchor ID that references a taxonomy term or location within SharePoint's managed metadata service. This class is used when working with SharePoint's taxonomy and term store functionality, allowing developers to associate content with specific taxonomy terms.

Source Code

class TaxonomyMetadata(ClientValue):
    def __init__(self, anchor_id=None):
        """
        :param str anchor_id:
        """
        self.anchorId = anchor_id

    @property
    def entity_type_name(self):
        return "SP.Publishing.TaxonomyMetadata"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

anchor_id: A string identifier that references a specific taxonomy term or anchor point in SharePoint's managed metadata service. This can be None if no anchor is specified. The anchor ID typically corresponds to a GUID or unique identifier for a term in the term store.

Return Value

Instantiation returns a TaxonomyMetadata object with the anchorId attribute set to the provided value (or None). The entity_type_name property returns the string 'SP.Publishing.TaxonomyMetadata', which identifies this object's type in SharePoint's client object model.

Class Interface

Methods

__init__(self, anchor_id=None) -> None

Purpose: Initializes a new TaxonomyMetadata instance with an optional anchor ID

Parameters:

  • anchor_id: Optional string representing the taxonomy term anchor identifier, defaults to None

Returns: None (constructor)

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name for this metadata object

Returns: String 'SP.Publishing.TaxonomyMetadata' identifying the SharePoint entity type

Attributes

Name Type Description Scope
anchorId str or None Stores the taxonomy term anchor identifier as a string, or None if not specified. This is the primary data payload of the class. instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue
from office365.sharepoint.publishing.taxonomy_metadata import TaxonomyMetadata

# Create a TaxonomyMetadata instance with an anchor ID
taxonomy_meta = TaxonomyMetadata(anchor_id="12345678-1234-1234-1234-123456789abc")

# Access the anchor ID
print(taxonomy_meta.anchorId)  # Output: 12345678-1234-1234-1234-123456789abc

# Get the entity type name
print(taxonomy_meta.entity_type_name)  # Output: SP.Publishing.TaxonomyMetadata

# Create instance without anchor ID
empty_taxonomy_meta = TaxonomyMetadata()
print(empty_taxonomy_meta.anchorId)  # Output: None

Best Practices

  • This class is a simple data container and should be instantiated with a valid anchor_id when referencing specific taxonomy terms
  • The anchorId attribute is publicly accessible and can be modified after instantiation if needed
  • This class inherits from ClientValue, which means it's designed for serialization in SharePoint API operations - do not add complex logic or methods that cannot be serialized
  • The entity_type_name property should not be overridden as it identifies the SharePoint entity type for proper API communication
  • When using with SharePoint APIs, ensure the anchor_id corresponds to a valid term GUID in the target SharePoint environment's term store
  • This class is immutable in practice - create new instances rather than modifying existing ones when working with different taxonomy references

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class TaxonomyFieldValue 75.9% similar

    Represents a single value held in a SharePoint TaxonomyField object, encapsulating taxonomy term metadata including label, GUID, and list item identifier.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/taxonomy/field_value.py
  • class TaxonomyField 70.4% similar

    Represents a SharePoint taxonomy field that allows tagging content with terms from a managed metadata term set, supporting both single and multiple value selections.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/taxonomy/field.py
  • class ContentTypeEntityData 68.1% similar

    A data class representing SharePoint content type entity metadata, inheriting from ClientValue to provide serialization capabilities for SharePoint API interactions.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/contenttypes/entity_data.py
  • class TaxonomyFieldValueCollection 67.0% similar

    A specialized collection class for managing multiple TaxonomyFieldValue objects, representing multi-value taxonomy columns in SharePoint/Office365.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/taxonomy/field_value.py
  • class TaxonomyItem 66.5% 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
← Back to Browse