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

File metadata

File hashes

Hashes for azurefunctions_extensions_connectors-1.0.0b2.tar.gz
Algorithm Hash digest
SHA256 bb7ab6df92befdd13789899dabb976d2eb959e80a3d1668203ae28fd9496e672
MD5 b732f1547168c2f7045d8fc484c49a21
BLAKE2b-256 a9d8a4359f2bff09053440e620c0ffc39be2a5588e30b26942ebbd2a36e4eff9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for azurefunctions_extensions_connectors-1.0.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ab25d036612066eb62d5765080ae2d2ff649d7c90d662915989f6c6e13c7383
MD5 ba9856977a4c245d02bec8bf1da3b4e9
BLAKE2b-256 a115d61899ca0572cff46430a7a99ebc3f4e9ef997049d8e4b53865f38fefa16

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