Airbyte source connector for extracting data from Microsoft OneDrive cloud storage with OAuth authentication and file-based streaming capabilities.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Comprehensive configuration models for Microsoft OneDrive source connector supporting multiple authentication methods, drive selection, and file filtering options. Built with Pydantic for validation and automatic schema generation.
Primary configuration class that extends Airbyte's file-based specification with OneDrive-specific parameters.
class SourceMicrosoftOneDriveSpec(AbstractFileBasedSpec, BaseModel):
credentials: Union[OAuthCredentials, ServiceCredentials]
drive_name: Optional[str]
search_scope: str
folder_path: str
class Config:
title = "Microsoft OneDrive Source Spec"
@classmethod
def documentation_url(cls) -> str:
"""
Provides the URL to the documentation for this specific source.
Returns:
str: Documentation URL for OneDrive integration setup
"""
@classmethod
def schema(cls, *args: Any, **kwargs: Any) -> Dict[str, Any]:
"""
Generates the schema mapping for configuration fields.
Cleans up legacy settings and processing options.
Parameters:
- args: Variable arguments passed to parent schema method
- kwargs: Keyword arguments passed to parent schema method
Returns:
Dict[str, Any]: Complete JSON schema for configuration validation
"""OAuth 2.0 credentials model for user-delegated authentication using Microsoft Graph API.
class OAuthCredentials(BaseModel):
auth_type: Literal["Client"]
tenant_id: str
client_id: str
client_secret: str
refresh_token: str
class Config:
title = "Authenticate via Microsoft (OAuth)"Field Descriptions:
tenant_id: Tenant ID of the Microsoft OneDrive user (marked as secret)client_id: Client ID of your Microsoft developer application (marked as secret)client_secret: Client Secret of your Microsoft developer application (marked as secret)refresh_token: Refresh Token of your Microsoft developer application (marked as secret)Service key authentication model for application-only access using service principal.
class ServiceCredentials(BaseModel):
auth_type: Literal["Service"]
tenant_id: str
user_principal_name: str
client_id: str
client_secret: str
class Config:
title = "Service Key Authentication"Field Descriptions:
tenant_id: Tenant ID of the Microsoft OneDrive user (marked as secret)user_principal_name: User Principal Name with special character encoding (marked as secret)client_id: Client ID of your Microsoft developer application (marked as secret)client_secret: Client Secret of your Microsoft developer application (marked as secret)Drive Selection:
drive_name: Optional[str] = Field(
title="Drive Name",
description="Name of the Microsoft OneDrive drive where the file(s) exist.",
default="OneDrive",
order=2
)Search Scope:
search_scope: str = Field(
title="Search Scope",
description="Specifies the location(s) to search for files. Valid options are 'ACCESSIBLE_DRIVES' to search in the selected OneDrive drive, 'SHARED_ITEMS' for shared items the user has access to, and 'ALL' to search both.",
default="ALL",
enum=["ACCESSIBLE_DRIVES", "SHARED_ITEMS", "ALL"],
order=3
)Folder Path:
folder_path: str = Field(
title="Folder Path",
description="Path to a specific folder within the drives to search for files. Leave empty to search all folders of the drives. This does not apply to shared items.",
order=4,
default="."
)oauth_config = {
"credentials": {
"auth_type": "Client",
"tenant_id": "12345678-1234-1234-1234-123456789012",
"client_id": "87654321-4321-4321-4321-210987654321",
"client_secret": "your-client-secret",
"refresh_token": "your-refresh-token"
},
"drive_name": "OneDrive",
"search_scope": "ACCESSIBLE_DRIVES",
"folder_path": "Documents/Reports",
"streams": [{
"name": "reports",
"globs": ["*.xlsx", "*.csv"],
"validation_policy": "Emit Record",
"format": {"filetype": "csv"}
}]
}service_config = {
"credentials": {
"auth_type": "Service",
"tenant_id": "12345678-1234-1234-1234-123456789012",
"user_principal_name": "datauser@company.onmicrosoft.com",
"client_id": "87654321-4321-4321-4321-210987654321",
"client_secret": "your-app-secret"
},
"drive_name": "OneDrive",
"search_scope": "ALL",
"folder_path": ".",
"streams": [{
"name": "all_files",
"globs": ["**/*"],
"validation_policy": "Emit Record",
"format": {"filetype": "unstructured"}
}]
}from source_microsoft_onedrive.spec import SourceMicrosoftOneDriveSpec
# Generate complete configuration schema
schema = SourceMicrosoftOneDriveSpec.schema()
# Access documentation URL
doc_url = SourceMicrosoftOneDriveSpec.documentation_url()
print(doc_url) # "https://docs.airbyte.com/integrations/sources/one-drive"All credential fields are marked with airbyte_secret=True for proper secret handling:
The Pydantic models provide automatic validation:
Install with Tessl CLI
npx tessl i tessl/pypi-source-microsoft-onedrive