pnpcore icon indicating copy to clipboard operation
pnpcore copied to clipboard

Unable to update ListItem with DateTime property

Open kavrat opened this issue 2 weeks ago • 0 comments

Category

  • [x] Bug

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)

  • SDK version: 1.12
  • OS: Windows 11
  • SDK used in: Azure Functions
  • Framework: .NET 8.0
  • Tooling:Rider IDE

kavrat avatar Jun 20 '24 15:06 kavrat