msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Cannot Use Update-MgSiteListItem or New-MgSiteListItem With a Hyperlink Field

Open DanielRumeo opened this issue 1 year ago • 2 comments

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

  • Make sure you can reproduce this issue using the latest released version of Microsoft.Graph or Microsoft.Graph.Beta.
  • Please search the existing issues to see if there has been a similar issue filed.
  • For issues related to authentication and service errors, please refer to our troubleshooting guide. For service issues, please open a question at https://developer.microsoft.com/graph/support.

Describe the bug

Try to add data to a SharePoint Hyperlink field either when creating a new item or modifying an existing item always returns an error (400 Bad Request Transfer Encoding)

To Reproduce Steps to reproduce the behavior:

  1. $Params = @{ fields = @{ __metadata = @{ type = "SP.Data.ListNameListItem" } Link = @{ __metadata = @{ type = "SP.FieldUrlValue" } Description = "Test" URL = "https://google.ca" } } }
  2. Execute Update-MgSiteListItem -SiteId $SiteId -ListId "Name of List" -ListItemId 186 -BodyParameter $Params
  3. See error Bad Request

Expected behavior

To be able to populate the field. This action works in PnP.PowerShell but not in MgGraph. I tried with an without

Debug Output

Run the problematic command with -Debug and paste the resulting debug stream below. ⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.

Module Version

2.11.1

Environment Data

PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Microsoft Windows 10.0.17763 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0..} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

I have been able to use everything else for these cmdlets without issue.

DanielRumeo avatar Feb 14 '24 17:02 DanielRumeo

I think that PnP.PowerShell works different endpoint than Graph PowerShell SDK.

What I remember, creating/updating hyperlink field is not supported through the Graph API.

https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/8040

MartinM85 avatar Feb 25 '24 10:02 MartinM85

Hi @DanielRumeo thank you for logging this issue. As per the API documentation here, hyperlink seems not to be part of the updatable properties. image

For API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it.

timayabi2020 avatar Mar 01 '24 09:03 timayabi2020

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.