Linking the Document Library to the Menu - Site team Theme
-
21-02-2021 - |
Question
I'm trying to add a theme for a team site. New theme i want add by Json and power shell. I have limitations to test my solution I need to ask someone to upload. The new theme should change the structure of the site in the following ways.
Delete from navigation on the left side:
- Conversations
- Documents
- Pages
- Site contents
- Project
- Notebook
Add to navigation on the left side
- Client Documents (type: document library, after click on the menu, a list of "General files" should appear)
1a) Opportunities(type: document library, sub link of Client Documents) 1b) Project(type: document library, sub link of Client Documents)
I'm doing this for the 1st time and can't test it in small steps . My main problem is to imagine if my Json structure will create such structure as I described. I was using the documentation: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema Unfortunately I don't know how to connect document library to make it look like "Client Documents" is a parent of "Opportunities" and "Project" I think I should use something with "parentDisplayName" but I don't know if I can use it for createSPList ?
{
"verb": "removeNavLink",
"displayName": "Conversations",
"isWebRelative": true
},
{
"verb": "removeNavLink",
"displayName": "Documents",
"isWebRelative": true
},
{
"verb": "removeNavLink",
"displayName": "Pages",
"isWebRelative": true
},
{
"verb": "removeNavLink",
"displayName": "Site contents",
"isWebRelative": true
},
{
"verb": "removeNavLink",
"displayName": "Project",
"isWebRelative": true
},
{
"verb": "removeNavLink",
"displayName": "Notebook",
"isWebRelative": true
},
{
"verb": "createSPList",
"listName": "Client Documents",
"templateType": 101
},
{
"verb": "createSPList",
"listName": "Opportunities",
"templateType": 101
},
{
"verb": "createSPList",
"listName": "Project",
"templateType": 101
}
Solution
You could use the addNavLink
sub action on createSPList
for Client Documents, this should create a link to Client Documents in the quick launch. After this action, use createSPList
to create the other two libraries without using the addNavLink
sub action (this would only create the links at the wrong level). For the last two actions, use the addNavLink
action to create links for the Opportunities and Projects libraries using the parentDisplayName
property to specify that these links should be children of the Client Documents link.
Update: You will need to set the navComponent
property in your removeNavLink
action to remove the links from your quick launch. More information can be found in the schema: