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:
- What is the correct format for the -d (dataset) parameter for SharePoint?
- Is this a known bug in PAC CLI version 1.50.1?
- 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.