Skip to main content

Office365 Connector Python worker extension for Azure Functions.

Project description

Azure Functions Extensions Connectors Office365 library for Python

This library allows Office365 Connector Triggers in Python Function Apps to recognize and bind to client types from the Azure Connectors SDK.

Office365 client types can be generated from:

  • Office365 Connector Triggers

Source code | Package (PyPi) | API reference documentation | Product documentation | Samples

Getting started

Prerequisites

Install the package

Install the Azure Functions Extensions Connectors Office365 library for Python with pip:

pip install azurefunctions-extensions-connectors-office365

Bind to the SDK-type

The Azure Functions Extensions Connectors Office365 library for Python allows you to create a function app with an Office365 Connector Trigger and define the type as a ClientReceiveMessage or List[ClientReceiveMessage]. Instead of receiving raw data, when the function is executed, the type returned will be the defined SDK-type and have all of the methods available from the azure-connectors SDK.

Key concepts

ClientReceiveMessage

The ClientReceiveMessage type represents a message received from an Office365 connector. The extension automatically parses the incoming JSON payload and converts it into typed ClientReceiveMessage objects from the azure-connectors SDK.

Cardinality

Office365 Connector Triggers support both single and batch message processing:

  • Single message (cardinality=one): Annotate your function parameter as ClientReceiveMessage to receive one message per function invocation
  • Batch messages (cardinality=many): Annotate your function parameter as List[ClientReceiveMessage] to receive multiple messages in a single function invocation

Examples

Office365 Connector Trigger - Single Message

import logging
import azure.functions as func
import azurefunctions.extensions.connectors.office365 as office365

app = func.FunctionApp()

@app.connector_trigger(arg_name="message", connection="OFFICE365_CONNECTION")
def office365_trigger_single(message: office365.ClientReceiveMessage):
    logging.info(f"Received Office365 message: {message}")
    # Access message properties using the Azure Connectors SDK methods

Office365 Connector Trigger - Batch Messages

import logging
from typing import List
import azure.functions as func
import azurefunctions.extensions.connectors.office365 as office365

app = func.FunctionApp()

@app.connector_trigger(arg_name="messages", connection="OFFICE365_CONNECTION")
def office365_trigger_batch(messages: List[office365.ClientReceiveMessage]):
    logging.info(f"Received {len(messages)} Office365 messages")
    for message in messages:
        logging.info(f"Processing message: {message}")
        # Access message properties using the Azure Connectors SDK methods

Troubleshooting

General

Office365 Connector extension errors will be raised as ValueError exceptions with descriptive error messages.

Logging

Enable verbose logging in your function app to see detailed information about message processing:

import logging
logging.basicConfig(level=logging.INFO)

Next steps

More sample code

Get started with our Office365 Connector samples.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file azurefunctions_extensions_connectors-1.0.0b1.tar.gz.

File metadata

File hashes

Hashes for azurefunctions_extensions_connectors-1.0.0b1.tar.gz
Algorithm Hash digest
SHA256 0c703c66e6fc82d12d98dbf22fae78aa859b1ea5f71993418f0375d79b2455d3
MD5 8483d890cba9712646ad92359046897d
BLAKE2b-256 9b80ddd01509c5c4b7b57ad0ffe492975cef4f38c4e4ab62c81ac271ddf4d7de

See more details on using hashes here.

File details

Details for the file azurefunctions_extensions_connectors-1.0.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for azurefunctions_extensions_connectors-1.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 14c7f8883a404cfee3c3b46a0dad06b018981f1e95417e36b1f22a6b08969348
MD5 762afb3d8eecedd3e9732895b094931f
BLAKE2b-256 9b8d732a2968544aeffad30dde198ba2369f3363f3775ef670e00a707d4d749e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page