Description
Describe the bug
The documentation for creating a new SharePoint site list in https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.sites/new-mgsitelist?view=graph-powershell-1.0&WT.mc_id=M365-MVP-9501 is incorrect and fails with a "New-MgSiteList_Create: Unable to determine type of provided column definition." The problem appears to have been around for a long time and people report being unable to use the cmdlet in Stack Overflow and other sites (here's an example: https://stackoverflow.com/questions/78712970/new-mgsitelist-unable-to-determine-type-of-provided-column-definition).
Expected behavior
The New-MgSiteList cmdlet should just work.
How to reproduce
Execute the New-MgSiteList example as documented. It won't work.
New-MgSiteList_Create:
Line |
20 | New-MgSiteList -SiteId $site.Id -BodyParameter $params
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to determine type of provided column definition
Status: 400 (BadRequest)
ErrorCode: invalidRequest
Date: 2024-08-12T16:27:30
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : b48f920f-198e-4504-bee3-9232c2c43850
client-request-id : f74ee450-f234-464c-932e-3dccf3ba495e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"011","RoleInstance":"DB1PEPF000508A1"}}
Date : Mon, 12 Aug 2024 16:27:30 GMT
SDK Version
2.21
Latest version known to work for scenario above?
Never, as far as I can see
Known Workarounds
Use the Graph request.
$Uri = ("https://graph.microsoft.com/v1.0/sites/{0}/Lists" -f $Site.Id)
invoke-MgGraphRequest -Uri $Uri -Method POST -Body $NewListParameters
Name Value
@odata.context https://graph.microsoft.com/v1.0/$metadata#sites('office365itpros.sharepoint.com%2Cbf887032-2619-44a2-a8b0-2b9cfb1cf701%2Ce95c0fd7-42a6-4bd8-808f-e4683035ed6e')/l…
description Contacts to add to User Address Book
list {[template, contacts], [hidden, False], [contentTypesEnabled, False]}
@odata.etag 4d117719-cd95-4047-b911-a1159446c949,10
createdDateTime 12/08/2024 16:31:59
lastModifiedDateTime 12/08/2024 16:32:00
createdBy {[user, System.Collections.Hashtable]}
parentReference {[siteId, office365itpros.sharepoint.com,bf887032-2619-44a2-a8b0-2b9cfb1cf701,e95c0fd7-42a6-4bd8-808f-e4683035ed6e]}
webUrl https://office365itpros.com/sites/Office365News/Lists/Organizational%20Contacts
name Organizational Contacts
id 4d117719-cd95-4047-b911-a1159446c949
eTag 4d117719-cd95-4047-b911-a1159446c949,10
displayName Organizational Contacts
Debug output
Click to expand log
```New-MgSiteList -SiteId $site.Id -BodyParameter $params -debug
DEBUG: [CmdletBeginProcessing]: - New-MgSiteList begin processing with parameterSet 'Create'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [AccessReview.Read.All, Agreement.Read.All, Analytics.Read, APIConnectors.Read.All, Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, AuditLogsQuery.Read.All, Calendars.Read, Calendars.ReadWrite, Channel.ReadBasic.All, ChannelMessage.Read.All, ChannelMessage.ReadWrite, ChannelMessage.Send, ChannelSettings.Read.All, ChannelSettings.ReadWrite.All, Chat.Create, Chat.ManageDeletion.All, Chat.ReadWrite, Community.ReadWrite.All, Contacts.ReadWrite, CrossTenantUserProfileSharing.Read, CrossTenantUserProfileSharing.Read.All, DelegatedPermissionGrant.ReadWrite.All, DeviceManagementManagedDevices.Read.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, DirectoryRecommendations.Read.All, Domain.Read.All, eDiscovery.Read.All, email, EntitlementManagement.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.Read.All, GroupMember.ReadWrite.All, IdentityProvider.Read.All, IdentityProvider.ReadWrite.All, IdentityRiskyUser.Read.All, IdentityRiskyUser.ReadWrite.All, IdentityUserFlow.Read.All, InformationProtectionPolicy.Read, Mail.Read, Mail.ReadWrite, Mail.Send, Mail.Send.Shared, MailboxSettings.ReadWrite, Notes.Create, OnlineMeetingArtifact.Read.All, OnlineMeetings.Read, openid, Organization.Read.All, PeopleSettings.Read.All, PeopleSettings.ReadWrite.All, Place.Read.All, Policy.Read.All, Policy.Read.PermissionGrant, Policy.ReadWrite.ApplicationConfiguration, Policy.ReadWrite.AuthenticationMethod, Policy.ReadWrite.ConditionalAccess, POP.AccessAsUser.All, PrivilegedAccess.Read.AzureAD, PrivilegedAccess.Read.AzureResources, profile, RecordsManagement.Read.All, Reports.Read.All, ReportSettings.ReadWrite.All, RoleAssignmentSchedule.Read.Directory, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.Read.Directory, RoleManagement.Read.All, RoleManagement.Read.Directory, SecurityActions.ReadWrite.All, SecurityEvents.Read.All, SecurityEvents.ReadWrite.All, ServiceHealth.Read.All, ServiceMessage.Read.All, SharePointTenantSettings.ReadWrite.All, Sites.FullControl.All, Sites.Manage.All, Sites.Read.All, Sites.ReadWrite.All, Tasks.Read, Tasks.ReadWrite, Team.ReadBasic.All, TeamMember.Read.All, TeamSettings.Read.All, TeamsTab.Read.All, TeamworkTag.ReadWrite, User.Read, User.Read.All, User.ReadBasic.All, User.ReadWrite, User.ReadWrite.All, UserActivity.ReadWrite.CreatedByApp, UserAuthenticationMethod.Read.All, UserAuthenticationMethod.ReadWrite.All, User-ConvertToInternal.ReadWrite.All, VirtualEvent.Read, WindowsUpdates.Read.All].
Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgSiteList_Create" on target "Call remote 'POST /sites/{site-id}/lists' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-IE),PowerShell/7.4.4
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.21.0
client-request-id : 0f58e2ac-bb5d-4080-8463-024ac792b078
Body:
{
"displayName": "Books",
"columns": [
{
"name": "Author"
},
{
"name": "PageCount"
}
],
"list": {
"template": "genericList"
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 153b3898-6bad-4290-b66a-4c734e1514e2
client-request-id : 0f58e2ac-bb5d-4080-8463-024ac792b078
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"011","RoleInstance":"DB1PEPF00043F22"}}
Date : Mon, 12 Aug 2024 16:29:09 GMT
Body:
{
"error": {
"code": "invalidRequest",
"message": "Unable to determine type of provided column definition",
"innerError": {
"date": "2024-08-12T16:29:09",
"request-id": "153b3898-6bad-4290-b66a-4c734e1514e2",
"client-request-id": "0f58e2ac-bb5d-4080-8463-024ac792b078"
}
}
}
New-MgSiteList_Create: Unable to determine type of provided column definition
Status: 400 (BadRequest)
ErrorCode: invalidRequest
Date: 2024-08-12T16:29:09
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 153b3898-6bad-4290-b66a-4c734e1514e2
client-request-id : 0f58e2ac-bb5d-4080-8463-024ac792b078
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"011","RoleInstance":"DB1PEPF00043F22"}}
Date : Mon, 12 Aug 2024 16:29:09 GMT
DEBUG: [CmdletEndProcessing]: - New-MgSiteList end processing.
Configuration
No response
Other information
No response