web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

pac code add-data-source fails with "Invalid URI format" for SharePoint connector

(0) ShareShare
ReportReport
Posted on by 28
 
I'm trying to add a SharePoint data source to a Power Apps Code App using the pac code add-data-source command, but it consistently fails with "Invalid URI format" error regardless of the dataset URL format I use.
 
Environment:
PAC CLI Version: 1.50.1+gabb74d2 (.NET Framework 4.8.9221.0)
OS: Windows 11
Feature: Power Apps Code Apps (Preview)

What I'm trying to do:
Connect a Code App to a SharePoint list using the SharePoint Online connector.
 
Steps I've taken:
Created and authenticated with Power Platform:
pac auth create --environment {my-environment-id}

Initialized the code app:
pac code init --displayName "My App"
Verified my connection exists:
pac connection list
Output shows my SharePoint connection with status "Connected"
Retrieved the Table ID by creating a canvas app, adding the SharePoint connection to a gallery, and inspecting the network traffic. Found the table GUID in the API hub URL.
Attempted to add the data source with multiple URL format variations:

Commands Attempted (all failed with same error):
# Attempt 1: Full URL with https
pac code add-data-source -a "shared_sharepointonline" -c "{connection-id}" -t "{table-guid}" -d "https://mytenant.sharepoint.com/sites/MySite"
# Attempt 2: URL encoded
pac code add-data-source -a "shared_sharepointonline" -c "{connection-id}" -t "{table-guid}" -d "https%3A%2F%2Fmytenant.sharepoint.com%2Fsites%2FMySite"
# Attempt 3: Without protocol
pac code add-data-source -a "shared_sharepointonline" -c "{connection-id}" -t "{table-guid}" -d "mytenant.sharepoint.com/sites/MySite"
# Attempt 4: Comma-separated format (like SQL example in docs)
pac code add-data-source -a "shared_sharepointonline" -c "{connection-id}" -t "{table-guid}" -d "mytenant.sharepoint.com,sites/MySite"
# Attempt 5: Just site name
pac code add-data-source -a "shared_sharepointonline" -c "{connection-id}" -t "{table-guid}" -d "MySite"
# Attempt 6: Using just GUID portion of connection ID
pac code add-data-source -a "shared_sharepointonline" -c "{guid-only}" -t "{table-guid}" -d "https://mytenant.sharepoint.com/sites/MySite"
 
Questions:
 
  1. What is the correct format for the -d (dataset) parameter for SharePoint?
  2. Is this a known bug in PAC CLI version 1.50.1?
  3. Are there any workarounds to add SharePoint as a data source to a Code App?
Documentation Reference:
I followed the steps in: https://learn.microsoft.com/en-us/power-apps/developer/code-apps/how-to/connect-to-data The documentation shows examples for SQL but the SharePoint dataset format isn't clear.

Error Output (same for all attempts):

Connected as user@domain.com
[INFO]: [AddDataSource.Start] {
  apiId: 'shared_sharepointonline',
  hasConnectionId: true,
  hasConnectionRef: false,
  hasSolutionId: false,
  tableName: '{table-guid}',
  dataset: '{attempted-dataset-value}',
  region: 'Public',
  environmentName: '{environment-id}'
}
[INFO]: [AddDataSource.Path.Connector] {
  apiId: 'shared_sharepointonline',
  tableName: '{table-guid}',
  dataset: '{attempted-dataset-value}',
  sqlStoredProcedure: ''
}
[INFO]: [AddDataSource.ServiceCall.GetConnector.Start] { apiId: 'shared_sharepointonline' }

Error: Invalid URI format.

Invalid URI format.
Categories:
I have the same question (0)
  • Verified answer
    accordeonist Profile Picture
    28 on at
    pac code add-data-source fails with "Invalid URI format" for SharePoint connector

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 651 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 385 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 230 Super User 2025 Season 2

Last 30 days Overall leaderboard