Modern Sharepoint Site Design - Doc Library Creation with Links!

Copper Contributor

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
Use this action to add to navigation: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema#ad...
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.
Thanks 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..
Have you tried using site designer.io we site? That will create the correct syntax for you.

@Alan MarshallThanks Alan that is an awesome tool I wasn't aware of before. I'm still struggling to get any of the above scripts to work -adding the quick link's. This must be causing others a headache. I notice if I create a new library from the "View All Contents Page" it offers an option to add link to quick links in a tickbox, so the logic must be sitting there somewhere; just beyond my comprehension. I'll let you know if I figure it out. Big thanks for the support..  

@Ronan Dowling Your 3rd site script posted doesn't appear to be right. "SetOnquicklaunch" is not a verb for site designs.

The 2nd site script (first on your second post) appears to be correct. Can you tell us what you mean by it doesn't seem to be working?

"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

@Scott Smith  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. 

    "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