Forum Discussion
OneDriveSharePoint shortcut with library variables error
- 3 months ago
Hi hvdbunte ,
Thank you for contacting the Microsoft Fabric community forum.
Yes, I think the API approach will fit much better once you start separating dev/test/prod environments. From your screenshots and the 400 error, it looks less like a syntax mistake and more like a limitation of variable substitution for SharePoint shortcut subpath values in the UI. The static path works, but the validation seems to fail when the variable is injected. With the REST API, you can simply generate the correct path during deployment instead of relying on UI interpolation.
Example:
POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{lakehouseId}/shortcuts
{
"path": "Files",
"name": "dev",
"target": {
"sharePoint": {
"connectionId": "<connection-id>",
"location": "https://contoso.sharepoint.com/sites/project",
"subpath": "General/import/dev"
}
}
}Then in your pipeline/script you only swap the environment value:
General/import/dev
General/import/test
General/import/prod
Also, Please refer to:
OneLake Shortcuts APIs available in Preview - Microsoft Fabric Community
OneLake Shortcuts - Create Shortcut - REST API (Core) | Microsoft Learn
Assign variables to shortcuts - Microsoft Fabric | Microsoft Learn
If I’ve misunderstood your needs or if you still encounter issues, please let us know.
Best Regards,
Community Support Team
Hi hvdbunte ,
Thank you for contacting the Microsoft Fabric community forum.
Yes, I think the API approach will fit much better once you start separating dev/test/prod environments. From your screenshots and the 400 error, it looks less like a syntax mistake and more like a limitation of variable substitution for SharePoint shortcut subpath values in the UI. The static path works, but the validation seems to fail when the variable is injected. With the REST API, you can simply generate the correct path during deployment instead of relying on UI interpolation.
Example:
POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{lakehouseId}/shortcuts
{
"path": "Files",
"name": "dev",
"target": {
"sharePoint": {
"connectionId": "<connection-id>",
"location": "https://contoso.sharepoint.com/sites/project",
"subpath": "General/import/dev"
}
}
}
Then in your pipeline/script you only swap the environment value:
General/import/dev
General/import/test
General/import/prod
Also, Please refer to:
OneLake Shortcuts APIs available in Preview - Microsoft Fabric Community
OneLake Shortcuts - Create Shortcut - REST API (Core) | Microsoft Learn
Assign variables to shortcuts - Microsoft Fabric | Microsoft Learn
If I’ve misunderstood your needs or if you still encounter issues, please let us know.
Best Regards,
Community Support Team
Hi v-menakakota,
Thank you for the detailed reply. I will have to test en implement this. But it looks very promising.
Kind Regards,
hvdbunte