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
I'm trying to add a new listitem using the PnP-SDK which contains a DateTime-field. Since me SharePoint site is based on "German" I get:
[2021-09-13T08:56:48.777Z] ---> System.ArgumentException: Unknown timezone mapping
[2021-09-13T08:56:48.777Z] at PnP.Core.Model.SharePoint.TimeZone.GetTimeZoneInfoFromSharePoint(String timeZoneDescription)
[2021-09-13T08:56:48.778Z] at PnP.Core.Model.SharePoint.TimeZone.UtcDelta(DateTime dateTime)
[2021-09-13T08:56:48.779Z] at PnP.Core.Model.SharePoint.TimeZone.UtcToLocalTime(DateTime dateTime)
[2021-09-13T08:56:48.780Z] at PnP.Core.Model.SharePoint.ListItem.DateTimeToSharePointWebDateTimeString(PnPContext context, DateTime input)
[2021-09-13T08:56:48.780Z] at PnP.Core.Model.SharePoint.ListItem.BuildValidateUpdateItemPayload(PnPContext context, KeyValuePair`2 changedProp, Object field)
[2021-09-13T08:56:48.781Z] at PnP.Core.Model.SharePoint.ListItem.<.ctor>b__2_2(Dictionary`2 keyValuePairs)
[2021-09-13T08:56:48.782Z] at PnP.Core.Model.BaseDataModel`1.AddBatchAsync(Batch batch, Dictionary`2 keyValuePairs)
[2021-09-13T08:56:48.783Z] at PnP.Core.Model.SharePoint.ListItemCollection.AddBatchAsync(Batch batch, Dictionary`2 values, String folderPath, FileSystemObjectType fileSystemObjectType)
[2021-09-13T08:56:48.784Z] at MyFunction.Function1.Run(String myBlob, String name, FunctionContext context) in C:\projects\playground\MyFunction\Function1.cs:line 119
[2021-09-13T08:56:48.785Z] at Microsoft.Azure.Functions.Worker.Invocation.VoidTaskMethodInvoker`2.InvokeAsync(TReflected instance, Object[] arguments) in D:\a\1\s\src\DotNetWorker.Core\Invocation\VoidTaskMethodInvoker.cs:line 22
[2021-09-13T08:56:48.785Z] --- End of inner exception stack trace ---
I looked at the code and found, that GetTimeZoneInfoFromSharePoint is only looking for english timezones. But instead of "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna" SharePoint is returning "(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien" instead.
Expected behavior
The timezone detection should work independed of language settings.
@henningeiben : I've just pushed a generic fix for non English time zone descriptions. There might be edge cases where time zones have the same time offset but different daylight savings, but for the majority of cases the chosen defaults should be good. I'll investigate if I can come up with a better solution.
Can you tomorrow try with our nightly build (version 1.3.50) and check if things work for you?
Category
Describe the bug
I'm trying to add a new listitem using the PnP-SDK which contains a DateTime-field. Since me SharePoint site is based on "German" I get:
I looked at the code and found, that GetTimeZoneInfoFromSharePoint is only looking for english timezones. But instead of "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna" SharePoint is returning "(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien" instead.
Expected behavior
The timezone detection should work independed of language settings.
Environment details (development & target environment)
The text was updated successfully, but these errors were encountered: