You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Playing around to test the fix for New-MgSiteList, I created a list as follows:
$params = @{
displayName = "Books"
columns = @(
@{
name = "Author"
text = @{ texttype = "plain | richtext" }
}
@{
name = "PageCount"
number = @{ displayas = "number | percentage" }
}
@{
name = "Website"
hyperlinkOrPicture = @{ isPicture = "false" }
}
)
list = @{
template = "genericList"
}
}
I can add items to the list with SharePoint Online. But when I attempt to add an item with New-MgSiteListItem, it barfs over the website field (the call works if the Website field is omitted).
Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgSiteListItem_Create" on target "Call remote 'POST /sites/{site-id}/lists/{list-id}/items' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================
Describe the bug
Playing around to test the fix for New-MgSiteList, I created a list as follows:
$params = @{
displayName = "Books"
columns = @(
@{
name = "Author"
text = @{ texttype = "plain | richtext" }
}
@{
name = "PageCount"
number = @{ displayas = "number | percentage" }
}
@{
name = "Website"
hyperlinkOrPicture = @{ isPicture = "false" }
}
}
I can add items to the list with SharePoint Online. But when I attempt to add an item with New-MgSiteListItem, it barfs over the website field (the call works if the Website field is omitted).
$NewItemParameters = @{
fields = @{
Title = 'PowerShell SDK'
Author0 = 'John Smith'
PageCount = '250'
Website = 'https://books.com/joy'
}
}
$NewItem = New-MgSiteListItem -SiteId $site.Id -ListId $List.Id -BodyParameter $NewItemParameters
New-MgSiteListItem_Create: General exception while processing
Status: 500 (InternalServerError)
ErrorCode: generalException
Date: 2024-08-14T12:46:32
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 9283d976-9b0d-4392-9db8-41e89f82743e
client-request-id : b4496d6e-9a93-4868-8826-9ed75019e7a9
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"DU2PEPF0002D4A6"}}
Date : Wed, 14 Aug 2024 12:46:32 GMT
Expected behavior
The New-MgSiteListItem cmdlet should work with fields marked as hyperlinkOrPicture
How to reproduce
Run the steps as shown above.
SDK Version
2.22
Latest version known to work for scenario above?
Never known to work
Known Workarounds
No response
Debug output
Click to expand log
``` $NewItem = New-MgSiteListItem -SiteId $site.Id -ListId $List.Id -BodyParameter $NewItemParameters -debug DEBUG: [CmdletBeginProcessing]: - New-MgSiteListItem begin processing with parameterSet 'Create'. DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'. DEBUG: [Authentication]: - Scopes: [Directory.AccessAsUser.All, Directory.ReadWrite.All, email, Files.Read.All, InformationProtectionPolicy.Read, openid, Policy.ReadWrite.Authorization, profile, RecordsManagement.Read.All, Sites.Manage.All, Sites.ReadWrite.All, User.Read, User.Read.All, User.ReadWrite, User.ReadWrite.All, UserAuthenticationMethod.ReadWrite.All].Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgSiteListItem_Create" on target "Call remote 'POST /sites/{site-id}/lists/{list-id}/items' 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
Absolute Uri:
https://graph.microsoft.com/v1.0/sites/o365maestro.sharepoint.com%2Cfbab3791-95db-4f31-8b07-d777742d60ab%2C14c87b0d-4876-4f7b-a839-23819618981f/lists/ae247a76-ed2f-4ded-8432-84ef2880e62d/items
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.22.0
client-request-id : 42d90d93-a26f-489d-865d-bae424842752
Body:
{
"fields": {
"Website": "https://books.com/joy",
"Title": "PowerShell SDK",
"Author0": "John Smith",
"PageCount": "250"
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
InternalServerError
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : bfa8f0e4-059b-49f9-945d-e7ead38a25c8
client-request-id : 42d90d93-a26f-489d-865d-bae424842752
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"DU2PEPF000107E5"}}
Date : Wed, 14 Aug 2024 12:52:30 GMT
Body:
{
"error": {
"code": "generalException",
"message": "General exception while processing",
"innerError": {
"date": "2024-08-14T12:52:30",
"request-id": "bfa8f0e4-059b-49f9-945d-e7ead38a25c8",
"client-request-id": "42d90d93-a26f-489d-865d-bae424842752"
}
}
}
New-MgSiteListItem_Create: General exception while processing
Status: 500 (InternalServerError)
ErrorCode: generalException
Date: 2024-08-14T12:52:30
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : bfa8f0e4-059b-49f9-945d-e7ead38a25c8
client-request-id : 42d90d93-a26f-489d-865d-bae424842752
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"DU2PEPF000107E5"}}
Date : Wed, 14 Aug 2024 12:52:30 GMT
DEBUG: [CmdletEndProcessing]: - New-MgSiteListItem end processing.
Configuration
Windows 11
Other information
No response
The text was updated successfully, but these errors were encountered: