Skip to content

New command: add new subsite to the specified site #189

@waldekmastykarz

Description

@waldekmastykarz

Add new subsite to the specified site

  • command: spo web add -t|--title <title> -u|--webUrl <webUrl> -w|--webTemplate <webTemplate> -p|--parentWebUrl <parentWebUrl> -d|--description [description] -l|--locale [locale] --breakInheritance --inheritNavigation
  • title: Subsite title
  • webUrl: last part of the URL for the subsite to be created (eg. subsite1 and not https://contoso.sharepoint.com/subsite1)
  • webTemplate: Subsite template, eg. STS#0 (Classic team site)
  • parentWebUrl: URL of the parent site under which to create the subsite
  • description: Subsite description, optional
  • locale: Subsite locale LCID, eg. 1033 for en-US
  • breakInheritance: Set to not inherit permissions from the parent site
  • inheritNavigation: Set to inherit the navigation from the parent site

Create subsite using:

POST <parentWebUrl>/_api/web/webinfos/add
accept: application/json;odata=nometadata
content-type: application/json;odata=nometadata
x-requestdigest: 0x5AB7E...

{
  "parameters": {  
    "Url": "<webUrl>",
    "Title": "<title>",
    "WebTemplate": "<webTemplate>",
    "UseUniquePermissions": <breakInheritance>
    ...
  }
}

Ensure you have access token for the web specified in the parentWebUrl option.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions