Forum Discussion
Modern Sharepoint Site Design - Doc Library Creation with Links!
Hi Folks,
I've created a basic Json Script which binds a Modern Site to a HUB. It also adds about seven doc libraries to the site. My issue is I would like these doc libraries to be navigable from the left hand links bar. But I can't seem to figure out how. Is it possible to do this from Json Script or flow?
Overview:
The boss want's to dictate the folder (library / folder) Structure for each function, so I thought Site Design would be the way forward. Employees can create a new site and then select the template (Site design) and the structure is prepopulated for them.
Script Summary:
{
"$schema": "schema.json",
"actions": [
{
"verb": "joinHubSite",
"hubSiteId": "n9d4b233-5c52-4d5b-9374-be78f92bee83"
},
{
"verb": "createSPList",
"listName": "PreDeal",
"templateType": 101,
"subactions": [
{
"verb": "setDescription",
"description": "All Predeal investment docs located here"
}
]
},...……….
Thanks
Ronan
7 Replies
- PittSharePointProIron Contributor"The boss want's to dictate the folder (library / folder) Structure..."
Is there a 'verb' to add folders to a doc library list? If so, what is it? I don't see it listed but might be missing a naming convention here. -- https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema- GinajCodeNinjaCopper Contributor
PittSharePointPro I know this is three years later - but for anyone searching for help....
Adding a folder can now be completed in the subactions segment of a actions set."$schema": "http://json-schema.org/draft-07/schema#","actions": [{"verb": "createSPList","listName": "23","templateType": 101,"addNavLink": true,"subactions": [{"verb": "setTitle","title": "23 Sales or Leasing"},{"verb": "addFolder","path": "Disclosure Statement"},{"verb": "addFolder","path": "Prices & Tracker"}]}...
Note: The "Set Title" is handy to use to keep the URL length of the library name shorter, while still going and renaming the library to the way you want the library to be actually named. This avoids having any %20's in the url, or adding a library name that is too long.
Thanks and happy scripting!
GinjaCodeNinja
- Alan MarshallIron ContributorUse this action to add to navigation: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema#add-a-navigation-link
If you want to add folders, you will need to call a Flow in the site script and in Flow use the add folder action.- Ronan DowlingCopper ContributorThanks Alan!
I was trying the following:
{
"verb": "createSPList",
"listName": "PreDeal",
"templateType": 101,
"subactions": [
{
"verb": "setDescription",
"description": "All predeal investment docs located here"
}
]
},
{
"verb": "addNavLink",
"url": "/Lists/PreDeal",
"displayName": "PreDeal",
"isWebRelative": true
},
However it doesn't seem to be working. I could put the full URL in but It would have to adapt to parent url for each site. Which is where I get a bit lost. I've also tried :
{
"verb": "createSPList",
"listName": "PreDeal",
"templateType": 101,
"subactions": [
{
"verb": "setOnquicklaunch",
"Onquicklaunch": "True"
}
]
},
Still having fun. I'll work it out. Thanks for the pointers..- Alan MarshallIron ContributorHave you tried using site designer.io we site? That will create the correct syntax for you.