0

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 enter image description here

  1. 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

  }
0

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:

JSON Schema for SiteScript Extensions

2
  • Thank you, do you know why this code does not remove my default fields in team, site ? { "verb": "removeNavLink", "displayName": "Documents", "isWebRelative": true },
    – Jelon3k
    Feb 16 at 17:32
  • I have updated the answer to include guidance regarding the removeNavLink action. If the answer is helpful, please let the community know by marking this as the answer. Feb 16 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.