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
When you call listItem.UpdateOverwriteVersionAsync() it hard-codes an empty string for the list ID that gets passed into the UpdateListItemRequest object here:
Since I am trying to iterate over files and folders it results in no ListId getting populated because I a folder is also a valid list item and results in the "Guid should contain 32 digits with 4 dashes" error message.
Steps to reproduce
I have some code like this:
List<IListItem>items=awaittargetFolder.GetChildFilesAndFoldersAsync();// Get some list items (folders AND files)foreach(variteminitems){varisFolder=awaititem.IsFolderAsync();varlistItem=isFolder?item.Folder.ListItemAllFields:item.File.ListItemAllFields;foreach(varcolumnValueincolumnValues){listItem[columnValue.FieldInternalName]=columnValue.DefaultValue;}awaitlistItem.UpdateOverwriteVersionAsync();// THIS FAILS}
Produces this error:
crit: Microsoft.Extensions.Hosting.Internal.Host[10]
The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
HttpResponseCode: 200
Message: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
ClientRequestId: 1c15bfa0-f06b-3000-c192-b9848adc2223
ErrorTypeName: "System.FormatException"
PnP.Core.CsomServiceException: CSOM service exception
at PnP.Core.Services.BatchClient.ProcessCsomBatchResponse(CsomBatch csomBatch, String batchResponse, HttpStatusCode statusCode)
at PnP.Core.Services.BatchClient.ExecuteCsomBatchAsync(Batch batch)
at PnP.Core.Services.BatchClient.ExecuteBatch(Batch batch)
at PnP.Core.Model.BaseDataModel`1.RequestAsync(ApiCall apiCall, HttpMethod method, String operationName) at PnP.Core.Model.BaseDataModel`1.RawRequestAsync(ApiCall apiCall, HttpMethod method, String operationName)
at PnP.Core.Model.SharePoint.ListItem.UpdateOverwriteVersionAsync()
The resulting query body that gets generated for the request looks like this:
I verified my ListItem and the folder both had UniqueId's present but they are not getting populated in this request. list::item:8635,1" /> should have a GUID right after list:<GUID_HERE> at the end of that request.
Expected behavior
The UpdateListItemRequest object should be populated with the correct ListId so the request succeeds instead of failing because no ListId was present in the request.
Thanks for debugging this @adamfisher , I've pushed a fix which will be included in the next nightly. Closing this issue, please re-open when you still have problems with this.
Category
Describe the bug
When you call
listItem.UpdateOverwriteVersionAsync()
it hard-codes an empty string for the list ID that gets passed into theUpdateListItemRequest
object here:pnpcore/src/sdk/PnP.Core/Services/Core/CSOM/Requests/ListItems/UpdateListItemRequest.cs
Line 53 in 9b8b7a9
The ListId property gets updated here for the request:
pnpcore/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/ListItem.cs
Lines 713 to 732 in 9b8b7a9
Since I am trying to iterate over files and folders it results in no ListId getting populated because I a folder is also a valid list item and results in the "Guid should contain 32 digits with 4 dashes" error message.
Steps to reproduce
I have some code like this:
Produces this error:
The resulting query body that gets generated for the request looks like this:
I verified my ListItem and the folder both had UniqueId's present but they are not getting populated in this request.
list::item:8635,1" />
should have a GUID right afterlist:<GUID_HERE>
at the end of that request.Expected behavior
The
UpdateListItemRequest
object should be populated with the correct ListId so the request succeeds instead of failing because noListId
was present in the request.Environment details (development & target environment)
The text was updated successfully, but these errors were encountered: