Skip to content

New command: add new list to the specified site #204

@waldekmastykarz

Description

@waldekmastykarz

Add new list to the specified site

  • command: spo list add -t|--title <title> --baseTemplate <baseTemplate> -u|--webUrl <webUrl> --description [description] --templateFeatureId [templateFeatureId] --schemaXml [schemaXml] (additional properties)
  • title: List title
  • baseTemplate: Integer representing the list template that should be used to create the list
  • webUrl: URL of the site where the list should be created
  • description: List description
  • templateFeatureId: ID of the Feature associated with the list
  • schemaXml: Schema XML used to create the list

List of additional properties that can be set:

AllowDeletion
AllowEveryoneViewItems
AllowMultiResponses
ContentTypesEnabled
CrawlNonDefaultViews
DefaultContentApprovalWorkflowId
DefaultDisplayFormUrl
DefaultEditFormUrl
Direction
DisableGridEditing
DraftVersionVisibility
EmailAlias
EnableAssignToEmail
EnableAttachments
EnableDeployWithDependentList
EnableFolderCreation
EnableMinorVersions
EnableModeration
EnablePeopleSelector
EnableResourceSelector
EnableSchemaCaching
EnableSyndication
EnableThrottling
EnableVersioning
EnforceDataValidation
ExcludeFromOfflineClient
FetchPropertyBagForListView
Followable
ForceCheckout
ForceDefaultContentType
Hidden
IncludedInMyFilesScope
IndexedRootFolderPropertyKeys
IrmEnabled
IrmExpire
IrmReject
IsApplicationList
ListExperienceOptions
MajorVersionLimit
MajorWithMinorVersionsLimit
MultipleDataList
NavigateForFormsPages
NeedUpdateSiteClientTag
NoCrawl
OnQuickLaunch
Ordered
ParserDisabled
ReadOnlyUI
ReadSecurity
RequestAccessEnabled
RestrictUserUpdates
SendToLocationName
SendToLocationUrl
ShowUser
SmsAlertTemplate
UseFormsForDisplay
ValidationFormula
ValidationMessage
WriteSecurity

For each property create a command option with corresponding basic type validation (eg. boolean, number, etc.). Take description of each property from https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist_properties.aspx.

Create list using:

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

{
  "Title": <title>,
  "BaseTemplate": <baseTemplate>,
  ...all other properties specified in the command
}

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions