-
Notifications
You must be signed in to change notification settings - Fork 192
Issue with New-MgSiteListItem #1185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@desmay, what error message are you getting? Please share the complete output of |
PS C:\Users\desmay> New-MgSiteListItem -listid $logListId -SiteId $siteId -Fields $hash -debug Confirm HTTP Method: Absolute Uri: Headers: Body: DEBUG: ============================ HTTP RESPONSE ============================ Status Code: Headers: Body: New-MgSiteListItem_CreateExpanded1: Field 'title' is not recognized |
PS C:\Users\desmay> $hash Name Value Title Something PS C:\Users\desmay> $PSVersionTable Name Value PSVersion 7.2.2 PS C:\Users\desmay> get-module ModuleType Version PreRelease Name ExportedCommands Script 1.9.3 Microsoft.Graph.Authentication {Add-MgEnvironment, Connect-MgGraph, Disconnect-M… |
I am having same issue |
I'm facing the same issue. If I add a column testColumn01 (lowercase "t") the command works! So the PowerShell module turns the field name to start with lowercase. |
I've noticed this same issue; the New-MgSiteListItem cmdlet converts the names from the -fields hashtable to lowercase. The "Title" field in a SharePoint List always has an uppercase "T" though, so there is currently no way to populate the Title column (even if you delete all of your other columns and recreate them with only lowercase letters). Edit: In case anyone's interested, it looks like it only converts the case of the first letter of the field. So "VMDetails" turns into "vMDetails". The issue with "Title" is still a show-stopper though, as I don't believe that we can rename that field. |
@NamedJason I noticed the same too about the lower-casing of the first letter. The error seems to come back too always for the alphabetically first field that was given. I had intent on upgrading some scripts that I've created for clients that uses MSGraphPSEssentials, as I want to switch them over to the official module. I'm trying with v1.9.6, so it seems like this issue is creeping through all the updates since v1.9.3. Darn. |
@JeremyTBradshaw Thanks for the advice. I've found a workaround, if you're interested. You can use create a custom object with a property called "fields" that contains another custom object that has the internal field names of the list that you want to add an item to (basically, setting up for the JSON file in the example on https://docs.microsoft.com/en-us/graph/api/listitem-create?view=graph-rest-1.0&tabs=http). Then use invoke-mggraphrequest -uri "v1.0/sites/{site-id}/lists/{list-id}/items" -method POST -body ($listObj | convertto-json) |
@peombwa Sorry to call you directly. Just wondering if you could please confirm whether this issue right here is the best place for this issue to be reported, in order to get noticed and get fixed. Is there anywhere else we could/should report this issue to make it an official priority? Thanks in advance. |
@JeremyTBradshaw, sorry for the delayed response. This looks like a service issue since other APIs support case-insensitive JSON request bodies. Please open a question for the workload owners at https://developer.microsoft.com/graph/support for them to investigate this. We will also follow up with the workload internally. I'll keep the issue open for us to see if we can mitigate this in the SDK by not serializing the JSON body in camelCase. As a workaround, please use the suggestion made in #1185 (comment). |
Hi @peombwa , I opted to open an MS Support case while I have the opportunity to. It's through a Premier Support client's contract, where I'm working on several MS Graph reliant PowerShell scripts. Thinking that will be better for locking in some eyes to look into a fix. I'll wait to hear back if you think I should still / also ask the question at https://development.microsoft.com/graph/support, or if that would be unnecessary now with the support case. Thanks again. Update: MS Support case ended because the issue is limited to the PowerShell SDK which is not supported by MS Support. Based on this, I'm going to do as you said in the first place and will ask the question over at the site you linked. Final update: Question asked - https://docs.microsoft.com/en-us/answers/questions/864180/problem-with-new-mgsitelistitem39s-fields-property.html |
@peombwa I've done as requested, asked the question, and then as directed from there, posted an idea. Here's hoping, and thanks. |
It looks like @JeremyTBradshaw is getting the hot-potato treatment on his various posts/tickets - can someone here confirm this is being worked on? I really want to love these cmdlets, but they don't make it easy. The workaround works for me (thanks!), though it took me a while to realize 'fields' needed to be lowercase in the body too.
|
@JeremyTBradshaw, @Mike-Crowley, sorry for the back and forth on this. After consulting with the workload owner, the solution is for us to make the property names case insensitive as the API is case sensitive, and field names can be of any case. This means that we will serialize fields as-is. We are working on having the fix available as part of the next SDK release. In the meantime, we recommend you use the workaround suggested above. |
Thanks for the update @peombwa . Also apologies for having put you in the hot seat. I took advantage of having seen you in another issue recently (retry handler stuff) and then noticing you were in here too. |
I updated my workstation to Microsoft.Graph.Sites to version 1.93. and the following command is failing.
New-MgSiteListItem -listid $logListId -SiteId $siteId -Fields @{Title = "Test"}
If I rollback to version 1.9.2 I have no issues and can create list items with code above.
The text was updated successfully, but these errors were encountered: