pnp / pnpcore

The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with SharePoint Online and Teams which is agnostic to the underlying API's being called
https://aka.ms/pnp/coresdk/docs
MIT License
288 stars 188 forks source link

Unable to update ListItem with DateTime property #1488

Open kavrat opened 3 weeks ago

kavrat commented 3 weeks ago

Category

Describe the bug

I'm trying to update a listitem with the DateTime property with a new value in UTC format, but I got an error:

Exception: System.ArgumentException: Unknown timezone mapping [2024-06-20T15:19:08.619Z] at PnP.Core.Model.SharePoint.TimeZone.GetTimeZoneInfoFromSharePoint(Int32 timeZoneId) [2024-06-20T15:19:08.619Z] at PnP.Core.Model.SharePoint.TimeZone.UtcDelta(DateTime dateTime) [2024-06-20T15:19:08.620Z] at PnP.Core.Model.SharePoint.TimeZone.UtcToLocalTime(DateTime dateTime) [2024-06-20T15:19:08.621Z] at PnP.Core.Model.SharePoint.ListItem.DateTimeToSharePointWebDateTimeString(PnPContext context, DateTime input) [2024-06-20T15:19:08.622Z] at PnP.Core.Model.SharePoint.ListItem.BuildValidateUpdateItemPayload(PnPContext context, KeyValuePair2 changedProp, Object field) [2024-06-20T15:19:08.622Z] at CallSite.Target(Closure, CallSite, ListItem, PnPContext, KeyValuePair2, Object) [2024-06-20T15:19:08.623Z] at PnP.Core.Model.SharePoint.ListItem.BuildUpdateApiCallAsync(PnPContext context) [2024-06-20T15:19:08.624Z] at PnP.Core.Model.SharePoint.ListItem.BaseUpdate(Func2 fromJsonCasting, Action1 postMappingJson) [2024-06-20T15:19:08.625Z] at PnP.Core.Model.BaseDataModel`1.UpdateAsync()

TimeZone of SharePoint site - (UTC-12:00 International Date Line West) Locale - German

Expected behavior

ListItem should be updated as expected

Environment details (development & target environment)