Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I'm using Microsoft Fabric and need help managing notebooks in my workspace. Specifically:
My current function lists objects in lakehouses:
# List all objects in the root folder
root = mssparkutils.fs.ls("/")
for item in root:
print(item.name) # Print the name of the object
# List all objects in the subfolder
subitems = mssparkutils.fs.ls(item.path)
for subitem in subitems:
print(" " + subitem.name) # Print the name of the subitem
# List all objects in the subsubfolder
subsubitems = mssparkutils.fs.ls(subitem.path)
for subsubitem in subsubitems:
print(" " + subsubitem.name) # Print the name of the subsubitem
However, this code doesn’t list my notebooks. Any guidance would be appreciated!
Thank you!
Solved! Go to Solution.
Hi @Nytar ,
Thanks @frithjof_v for your reply.
Please execute the following code in notebook:
import requests
workspaceID = 'your_workspace_id'
api_url = f'https://api.fabric.microsoft.com/v1/workspaces/{workspaceID}/notebooks'
headers = {
"Authorization": "Bearer your_token",
"Content-Type": "application/json"
}
res = requests.get(api_url,headers=headers)
note = res.json().get("value",[])
for note in note:
if note['type'] == 'Notebook':
print(note['displayName'])
Replace workspaceid and your_token with your own.
The result of the execution is shown below, which lists all the notebooks in my workspace.
You can click on this official document for more information about it:
Items - List Notebooks - REST API (Notebook) | Microsoft Learn
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @Nytar ,
Thanks @frithjof_v for your reply.
Please execute the following code in notebook:
import requests
workspaceID = 'your_workspace_id'
api_url = f'https://api.fabric.microsoft.com/v1/workspaces/{workspaceID}/notebooks'
headers = {
"Authorization": "Bearer your_token",
"Content-Type": "application/json"
}
res = requests.get(api_url,headers=headers)
note = res.json().get("value",[])
for note in note:
if note['type'] == 'Notebook':
print(note['displayName'])
Replace workspaceid and your_token with your own.
The result of the execution is shown below, which lists all the notebooks in my workspace.
You can click on this official document for more information about it:
Items - List Notebooks - REST API (Notebook) | Microsoft Learn
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
1. Perhaps this will do the job, it also seems to list the notebooks in the workspace: https://fabric.guru/one-line-code-to-get-a-list-of-items-from-all-the-fabricpremium-workspaces
2. I think you can use some of the functions found here:
Edit: this blog shows how to achieve both 1. and 2.:
https://fabric.guru/using-runmultiple-to-orchastrate-notebook-execution-in-microsoft-fabric
To list all notebooks in the workspace:
import sempy.fabric as fabric
notebooks = fabric.list_items().query("Type == 'Notebook'")
notebooks