Skip to content

Conversation

nsklei
Copy link
Contributor

@nsklei nsklei commented Sep 25, 2025

Description

This commit adds support for Microsoft Teams SharePoint URLs (/teams/) in addition to the existing SharePoint site collection URLs (/sites/). Previously, the connector only worked with URLs like https://tenant.sharepoint.com/sites/sitename, but now it also supports https://gteu.sharepoint.com/teams/teamname.

How Has This Been Tested?

I tested the functionality manually by building the images locally and starting the application.

Additional Options

  • [Optional] Override Linear Check

Summary by cubic

Adds support for SharePoint Teams URLs (/teams/) so the connector works with team sites as well as site collections. This enables URLs like https://tenant.sharepoint.com/teams/team-name to be validated and parsed correctly.

  • New Features
    • Accepts /teams/ URLs in validation and parsing alongside /sites/.
    • Extracts base site/team URL, drive name, and optional folder path.

@nsklei nsklei requested a review from a team as a code owner September 25, 2025 20:24
Copy link

vercel bot commented Sep 25, 2025

Someone is attempting to deploy a commit to the Danswer Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR extends the SharePoint connector to support Microsoft Teams URLs (/teams/) in addition to the existing SharePoint site collection URLs (/sites/). The implementation is clean and maintains backward compatibility.

Key Changes:

  • Updated URL validation to accept both /sites/ and /teams/ patterns
  • Modified URL parsing logic to handle both site types with a unified approach
  • Updated documentation strings and error messages to reflect the new capability
  • No breaking changes to existing functionality

The changes are well-implemented with proper error handling, logging, and validation. The code follows existing patterns and maintains the same abstraction level throughout the connector.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects well-structured code changes that extend functionality without breaking existing behavior. The implementation follows established patterns, includes proper validation and error handling, and maintains backward compatibility.
  • No files require special attention

Important Files Changed

File Analysis

Filename        Score        Overview
backend/onyx/connectors/sharepoint/connector.py 5/5 Added support for Microsoft Teams SharePoint URLs (/teams/) alongside existing /sites/ URLs. Clean implementation with proper validation and error messages.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant Connector as SharepointConnector
    participant Validator as validate_connector_settings
    participant Extractor as _extract_site_and_drive_info
    participant Logger as Logger

    User->>Connector: Initialize with sites URLs
    Note over User: URLs can be /sites/ or /teams/
    
    Connector->>Validator: validate_connector_settings()
    
    loop For each site URL
        Validator->>Validator: Check if URL starts with "https://"
        alt URL contains "/sites/" or "/teams/"
            Validator->>Validator: Validation passes
        else Invalid URL format
            Validator->>User: Throw ConnectorValidationError
            Note over Validator: "Site URLs must be full Sharepoint URLs..."
        end
    end
    
    Connector->>Extractor: _extract_site_and_drive_info(sites)
    
    loop For each URL
        Extractor->>Extractor: Split URL by "/"
        
        alt URL contains "sites"
            Extractor->>Extractor: Find "sites" index
            Extractor->>Extractor: Set site_type_index
        else URL contains "teams"
            Extractor->>Extractor: Find "teams" index  
            Extractor->>Extractor: Set site_type_index
        else Neither sites nor teams
            Extractor->>Logger: Log warning about invalid URL
            Note over Logger: "Site URL is not valid (must contain /sites/ or /teams/)"
        end
        
        alt site_type_index is not None
            Extractor->>Extractor: Extract base site URL (up to site/team name)
            Extractor->>Extractor: Parse remaining parts for drive/folder
            Extractor->>Extractor: Create SiteDescriptor object
        end
    end
    
    Extractor->>Connector: Return list of SiteDescriptor objects
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nsklei
Copy link
Contributor Author

nsklei commented Oct 2, 2025

@wenxi-onyx Are there any concerns about this PR?

@wenxi-onyx wenxi-onyx self-requested a review October 3, 2025 20:31
@wenxi-onyx wenxi-onyx self-assigned this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants