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

azurefunctions_extensions_connectors-1.0.0b3.tar.gz (11.7 kB view details)

Uploaded Source

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.0b3.tar.gz.

File metadata

File hashes

Hashes for azurefunctions_extensions_connectors-1.0.0b3.tar.gz
Algorithm Hash digest
SHA256 e2b28e2e13dce5e5566912edcce50e5fe69b278b909df12f15dbf7daf03d14aa
MD5 4b795e50f0d8288fd7538339ccfb94eb
BLAKE2b-256 354cd1d3ad988e04516e4cffaf1c0f6c656792e04b02dd5d692da7d1b4082124

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for azurefunctions_extensions_connectors-1.0.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 04f3bcaebad376bc57f0eb4a5c7e52dcb3206f98572156d8f3f7892ee4be34f3
MD5 00126dbb4f4672536729fbe47c4bf46f
BLAKE2b-256 df9b90d3088ba893cacdfb83c6f479dc194999eb2e71fa9bc277f32324cda272

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