diff --git a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00000.response.json b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00000.response.json
index ca0492818e..e290dcde9b 100644
--- a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00000.response.json
+++ b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00000.response.json
@@ -1 +1 @@
-{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"9b7430a0-800d-3000-e36d-7e3a016e05b1","SPClientServiceRequestDuration":"16","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022RegionalSettings\u0022:{\u0022TimeZone\u0022:{\u0022Description\u0022:\u0022(UTC\u002B01:00) Brussels, Copenhagen, Madrid, Paris\u0022,\u0022Id\u0022:3,\u0022Information\u0022:{\u0022Bias\u0022:-60,\u0022DaylightBias\u0022:-60,\u0022StandardBias\u0022:0}},\u0022AdjustHijriDays\u0022:0,\u0022AlternateCalendarType\u0022:0,\u0022AM\u0022:\u0022\u0022,\u0022CalendarType\u0022:1,\u0022Collation\u0022:25,\u0022CollationLCID\u0022:2070,\u0022DateFormat\u0022:1,\u0022DateSeparator\u0022:\u0022/\u0022,\u0022DecimalSeparator\u0022:\u0022,\u0022,\u0022DigitGrouping\u0022:\u00223;0\u0022,\u0022FirstDayOfWeek\u0022:1,\u0022FirstWeekOfYear\u0022:2,\u0022IsEastAsia\u0022:false,\u0022IsRightToLeft\u0022:false,\u0022IsUIRightToLeft\u0022:false,\u0022ListSeparator\u0022:\u0022;\u0022,\u0022LocaleId\u0022:2067,\u0022NegativeSign\u0022:\u0022-\u0022,\u0022NegNumberMode\u0022:1,\u0022PM\u0022:\u0022\u0022,\u0022PositiveSign\u0022:\u0022\u0022,\u0022ShowWeeks\u0022:false,\u0022ThousandSeparator\u0022:\u0022.\u0022,\u0022Time24\u0022:true,\u0022TimeMarkerPosition\u0022:0,\u0022TimeSeparator\u0022:\u0022:\u0022,\u0022WorkDayEndHour\u0022:1020,\u0022WorkDays\u0022:62,\u0022WorkDayStartHour\u0022:480},\u0022Id\u0022:\u00228c8e101c-1b0d-4253-85e7-c30039bf46e2\u0022,\u0022Url\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-1\u0022}"}
\ No newline at end of file
+{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1eae30a0-b00a-3000-e36d-7d609f931233","SPClientServiceRequestDuration":"459","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022RegionalSettings\u0022:{\u0022TimeZone\u0022:{\u0022Description\u0022:\u0022(UTC\u002B01:00) Brussels, Copenhagen, Madrid, Paris\u0022,\u0022Id\u0022:3,\u0022Information\u0022:{\u0022Bias\u0022:-60,\u0022DaylightBias\u0022:-60,\u0022StandardBias\u0022:0}},\u0022AdjustHijriDays\u0022:0,\u0022AlternateCalendarType\u0022:0,\u0022AM\u0022:\u0022\u0022,\u0022CalendarType\u0022:1,\u0022Collation\u0022:25,\u0022CollationLCID\u0022:2070,\u0022DateFormat\u0022:1,\u0022DateSeparator\u0022:\u0022/\u0022,\u0022DecimalSeparator\u0022:\u0022,\u0022,\u0022DigitGrouping\u0022:\u00223;0\u0022,\u0022FirstDayOfWeek\u0022:1,\u0022FirstWeekOfYear\u0022:2,\u0022IsEastAsia\u0022:false,\u0022IsRightToLeft\u0022:false,\u0022IsUIRightToLeft\u0022:false,\u0022ListSeparator\u0022:\u0022;\u0022,\u0022LocaleId\u0022:2067,\u0022NegativeSign\u0022:\u0022-\u0022,\u0022NegNumberMode\u0022:1,\u0022PM\u0022:\u0022\u0022,\u0022PositiveSign\u0022:\u0022\u0022,\u0022ShowWeeks\u0022:false,\u0022ThousandSeparator\u0022:\u0022.\u0022,\u0022Time24\u0022:true,\u0022TimeMarkerPosition\u0022:0,\u0022TimeSeparator\u0022:\u0022:\u0022,\u0022WorkDayEndHour\u0022:1020,\u0022WorkDays\u0022:62,\u0022WorkDayStartHour\u0022:480},\u0022Id\u0022:\u00228c8e101c-1b0d-4253-85e7-c30039bf46e2\u0022,\u0022Url\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-1\u0022}"}
\ No newline at end of file
diff --git a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00001.response.json b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00001.response.json
index 90a2ff18eb..353f7a96ae 100644
--- a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00001.response.json
+++ b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00001.response.json
@@ -1 +1 @@
-{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"9b7430a0-f01c-3000-fd80-aef2b16b8ccf","SPClientServiceRequestDuration":"8","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u0022b32780e9-df70-4548-a735-4e7f055415a1\u0022,\u0022Id\u0022:\u0022b56adf79-ff6a-4964-a63a-ff1fa23be9f8\u0022}"}
\ No newline at end of file
+{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1eae30a0-c038-4000-312e-3d20e028fa2b","SPClientServiceRequestDuration":"8","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u0022b32780e9-df70-4548-a735-4e7f055415a1\u0022,\u0022Id\u0022:\u0022b56adf79-ff6a-4964-a63a-ff1fa23be9f8\u0022}"}
\ No newline at end of file
diff --git a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00002.response.json b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00002.response.json
index 804ee3076e..a7dbc3d60a 100644
--- a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00002.response.json
+++ b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-0-00002.response.json
@@ -1 +1 @@
-{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"9b7430a0-2025-4000-312e-34131f359e2b","SPClientServiceRequestDuration":"10","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022Description\u0022:\u0022prov-1\u0022,\u0022Id\u0022:\u00228c8e101c-1b0d-4253-85e7-c30039bf46e2\u0022,\u0022Language\u0022:1033,\u0022Title\u0022:\u0022prov-1\u0022,\u0022WebTemplate\u0022:\u0022GROUP\u0022,\u0022WebTemplateConfiguration\u0022:\u0022GROUP#0\u0022}"}
\ No newline at end of file
+{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1eae30a0-f040-4000-312e-323640fee3e0","SPClientServiceRequestDuration":"8","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022Description\u0022:\u0022prov-1\u0022,\u0022Id\u0022:\u00228c8e101c-1b0d-4253-85e7-c30039bf46e2\u0022,\u0022Language\u0022:1033,\u0022Title\u0022:\u0022prov-1\u0022,\u0022WebTemplate\u0022:\u0022GROUP\u0022,\u0022WebTemplateConfiguration\u0022:\u0022GROUP#0\u0022}"}
\ No newline at end of file
diff --git a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00000.response.json b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00000.response.json
index 88d74bbcff..91b7c90945 100644
--- a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00000.response.json
+++ b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00000.response.json
@@ -1 +1 @@
-{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"9b7430a0-f099-3000-e1e0-e6a71e298250","SPClientServiceRequestDuration":"9","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022RegionalSettings\u0022:{\u0022TimeZone\u0022:{\u0022Description\u0022:\u0022(UTC-08:00) Pacific Time (US and Canada)\u0022,\u0022Id\u0022:13,\u0022Information\u0022:{\u0022Bias\u0022:480,\u0022DaylightBias\u0022:-60,\u0022StandardBias\u0022:0}},\u0022AdjustHijriDays\u0022:0,\u0022AlternateCalendarType\u0022:0,\u0022AM\u0022:\u0022AM\u0022,\u0022CalendarType\u0022:1,\u0022Collation\u0022:25,\u0022CollationLCID\u0022:2070,\u0022DateFormat\u0022:0,\u0022DateSeparator\u0022:\u0022/\u0022,\u0022DecimalSeparator\u0022:\u0022.\u0022,\u0022DigitGrouping\u0022:\u00223;0\u0022,\u0022FirstDayOfWeek\u0022:0,\u0022FirstWeekOfYear\u0022:0,\u0022IsEastAsia\u0022:false,\u0022IsRightToLeft\u0022:false,\u0022IsUIRightToLeft\u0022:false,\u0022ListSeparator\u0022:\u0022,\u0022,\u0022LocaleId\u0022:1033,\u0022NegativeSign\u0022:\u0022-\u0022,\u0022NegNumberMode\u0022:1,\u0022PM\u0022:\u0022PM\u0022,\u0022PositiveSign\u0022:\u0022\u0022,\u0022ShowWeeks\u0022:false,\u0022ThousandSeparator\u0022:\u0022,\u0022,\u0022Time24\u0022:false,\u0022TimeMarkerPosition\u0022:0,\u0022TimeSeparator\u0022:\u0022:\u0022,\u0022WorkDayEndHour\u0022:1020,\u0022WorkDays\u0022:62,\u0022WorkDayStartHour\u0022:480},\u0022Id\u0022:\u0022a5f687e3-6783-4295-8e6f-f95fb09c1d83\u0022,\u0022Url\u0022:\u0022https://bertonline-admin.sharepoint.com\u0022}"}
\ No newline at end of file
+{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1eae30a0-a0c6-3000-f132-8351d2eedd3a","SPClientServiceRequestDuration":"12","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022RegionalSettings\u0022:{\u0022TimeZone\u0022:{\u0022Description\u0022:\u0022(UTC-08:00) Pacific Time (US and Canada)\u0022,\u0022Id\u0022:13,\u0022Information\u0022:{\u0022Bias\u0022:480,\u0022DaylightBias\u0022:-60,\u0022StandardBias\u0022:0}},\u0022AdjustHijriDays\u0022:0,\u0022AlternateCalendarType\u0022:0,\u0022AM\u0022:\u0022AM\u0022,\u0022CalendarType\u0022:1,\u0022Collation\u0022:25,\u0022CollationLCID\u0022:2070,\u0022DateFormat\u0022:0,\u0022DateSeparator\u0022:\u0022/\u0022,\u0022DecimalSeparator\u0022:\u0022.\u0022,\u0022DigitGrouping\u0022:\u00223;0\u0022,\u0022FirstDayOfWeek\u0022:0,\u0022FirstWeekOfYear\u0022:0,\u0022IsEastAsia\u0022:false,\u0022IsRightToLeft\u0022:false,\u0022IsUIRightToLeft\u0022:false,\u0022ListSeparator\u0022:\u0022,\u0022,\u0022LocaleId\u0022:1033,\u0022NegativeSign\u0022:\u0022-\u0022,\u0022NegNumberMode\u0022:1,\u0022PM\u0022:\u0022PM\u0022,\u0022PositiveSign\u0022:\u0022\u0022,\u0022ShowWeeks\u0022:false,\u0022ThousandSeparator\u0022:\u0022,\u0022,\u0022Time24\u0022:false,\u0022TimeMarkerPosition\u0022:0,\u0022TimeSeparator\u0022:\u0022:\u0022,\u0022WorkDayEndHour\u0022:1020,\u0022WorkDays\u0022:62,\u0022WorkDayStartHour\u0022:480},\u0022Id\u0022:\u0022a5f687e3-6783-4295-8e6f-f95fb09c1d83\u0022,\u0022Url\u0022:\u0022https://bertonline-admin.sharepoint.com\u0022}"}
\ No newline at end of file
diff --git a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00001.response.json b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00001.response.json
index 254aeaf410..3f7cf3dccd 100644
--- a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00001.response.json
+++ b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00001.response.json
@@ -1 +1 @@
-{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"9b7430a0-80a0-3000-fdbe-c0f6376c5e29","SPClientServiceRequestDuration":"10","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u002200000000-0000-0000-0000-000000000000\u0022,\u0022Id\u0022:\u0022159c6b93-32dc-45d5-a376-7b03ea9ad542\u0022}"}
\ No newline at end of file
+{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1eae30a0-c0cd-3000-f132-8cb23c61c079","SPClientServiceRequestDuration":"8","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u002200000000-0000-0000-0000-000000000000\u0022,\u0022Id\u0022:\u0022159c6b93-32dc-45d5-a376-7b03ea9ad542\u0022}"}
\ No newline at end of file
diff --git a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00002.response.json b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00002.response.json
index 41883a40d5..8c39f4e8b9 100644
--- a/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00002.response.json
+++ b/src/sdk/PnP.Core.Admin.Test/SharePoint/MockData/SiteManagerTests/GetSiteCollectionProperties-100-00002.response.json
@@ -1 +1 @@
-{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"9b7430a0-90a7-3000-e1e0-e8a0a759e6ab","SPClientServiceRequestDuration":"449","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"[\r{\r\u0022SchemaVersion\u0022:\u002215.0.0.0\u0022,\u0022LibraryVersion\u0022:\u002216.0.22316.12004\u0022,\u0022ErrorInfo\u0022:null,\u0022TraceCorrelationId\u0022:\u00229b7430a0-90a7-3000-e1e0-e8a0a759e6ab\u0022\r},4,{\r\u0022IsNull\u0022:false\r},5,{\r\u0022IsNull\u0022:false\r},2,{\r\u0022_ObjectType_\u0022:\u0022Microsoft.Online.SharePoint.TenantAdministration.SiteProperties\u0022,\u0022_ObjectIdentity_\u0022:\u00229b7430a0-90a7-3000-e1e0-e8a0a759e6ab|908bed80-a04a-4433-b4a0-883d9847d110:6492ece7-7f5d-4499-8130-50e761e25bd9\\nSiteProperties\\nhttps%3a%2f%2fbertonline.sharepoint.com%2fsites%2fprov-1\u0022,\u0022AllowDownloadingNonWebViewableFiles\u0022:false,\u0022AllowEditing\u0022:true,\u0022AllowSelfServiceUpgrade\u0022:true,\u0022AnonymousLinkExpirationInDays\u0022:0,\u0022AuthContextStrength\u0022:null,\u0022AuthenticationContextName\u0022:null,\u0022AverageResourceUsage\u0022:0,\u0022BlockDownloadLinksFileType\u0022:1,\u0022BlockDownloadMicrosoft365GroupIds\u0022:null,\u0022BlockDownloadPolicy\u0022:false,\u0022CommentsOnSitePagesDisabled\u0022:false,\u0022CompatibilityLevel\u0022:15,\u0022ConditionalAccessPolicy\u0022:0,\u0022CurrentResourceUsage\u0022:0,\u0022DefaultLinkPermission\u0022:0,\u0022DefaultLinkToExistingAccess\u0022:false,\u0022DefaultLinkToExistingAccessReset\u0022:false,\u0022DefaultSharingLinkType\u0022:0,\u0022DenyAddAndCustomizePages\u0022:2,\u0022Description\u0022:\u0022prov-1\u0022,\u0022DisableAppViews\u0022:2,\u0022DisableCompanyWideSharingLinks\u0022:2,\u0022DisableFlows\u0022:2,\u0022ExcludedBlockDownloadGroupIds\u0022:null,\u0022ExternalUserExpirationInDays\u0022:0,\u0022GroupId\u0022:\u0022\\/Guid(b32780e9-df70-4548-a735-4e7f055415a1)\\/\u0022,\u0022GroupOwnerLoginName\u0022:\u0022c:0o.c|federateddirectoryclaimprovider|b32780e9-df70-4548-a735-4e7f055415a1_o\u0022,\u0022HasHolds\u0022:false,\u0022HubSiteId\u0022:\u0022\\/Guid(00000000-0000-0000-0000-000000000000)\\/\u0022,\u0022IBMode\u0022:\u0022\u0022,\u0022IBSegments\u0022:[\r\r],\u0022IBSegmentsToAdd\u0022:null,\u0022IBSegmentsToRemove\u0022:null,\u0022IsGroupOwnerSiteAdmin\u0022:true,\u0022IsHubSite\u0022:false,\u0022IsTeamsChannelConnected\u0022:false,\u0022IsTeamsConnected\u0022:true,\u0022LastContentModifiedDate\u0022:\u0022\\/Date(2022,2,29,9,40,58,397)\\/\u0022,\u0022Lcid\u0022:2067,\u0022LimitedAccessFileType\u0022:1,\u0022LockIssue\u0022:null,\u0022LockState\u0022:\u0022Unlock\u0022,\u0022LoopDefaultSharingLinkRole\u0022:0,\u0022LoopDefaultSharingLinkScope\u0022:-1,\u0022LoopOverrideSharingCapability\u0022:false,\u0022LoopSharingCapability\u0022:1,\u0022MediaTranscription\u0022:0,\u0022OverrideBlockUserInfoVisibility\u0022:0,\u0022OverrideTenantAnonymousLinkExpirationPolicy\u0022:false,\u0022OverrideTenantExternalUserExpirationPolicy\u0022:false,\u0022Owner\u0022:\u0022b32780e9-df70-4548-a735-4e7f055415a1_o\u0022,\u0022OwnerEmail\u0022:\u0022prov-1@bertonline.onmicrosoft.com\u0022,\u0022OwnerLoginName\u0022:\u0022c:0o.c|federateddirectoryclaimprovider|b32780e9-df70-4548-a735-4e7f055415a1_o\u0022,\u0022OwnerName\u0022:\u0022prov-1\u0022,\u0022PWAEnabled\u0022:1,\u0022ReadOnlyAccessPolicy\u0022:false,\u0022RelatedGroupId\u0022:\u0022\\/Guid(b32780e9-df70-4548-a735-4e7f055415a1)\\/\u0022,\u0022RestrictedToRegion\u0022:3,\u0022SandboxedCodeActivationCapability\u0022:2,\u0022SensitivityLabel\u0022:\u0022\\/Guid(00000000-0000-0000-0000-000000000000)\\/\u0022,\u0022SensitivityLabel2\u0022:\u0022\u0022,\u0022SetOwnerWithoutUpdatingSecondaryAdmin\u0022:false,\u0022SharingAllowedDomainList\u0022:\u0022\u0022,\u0022SharingBlockedDomainList\u0022:\u0022\u0022,\u0022SharingCapability\u0022:1,\u0022SharingDomainRestrictionMode\u0022:0,\u0022SharingLockDownCanBeCleared\u0022:true,\u0022SharingLockDownEnabled\u0022:false,\u0022ShowPeoplePickerSuggestionsForGuestUsers\u0022:false,\u0022SiteDefinedSharingCapability\u0022:1,\u0022SocialBarOnSitePagesDisabled\u0022:false,\u0022Status\u0022:\u0022Active\u0022,\u0022StorageMaximumLevel\u0022:26214400,\u0022StorageQuotaType\u0022:null,\u0022StorageUsage\u0022:4464,\u0022StorageWarningLevel\u0022:25574400,\u0022TeamsChannelType\u0022:0,\u0022Template\u0022:\u0022GROUP#0\u0022,\u0022TimeZoneId\u0022:3,\u0022Title\u0022:\u0022prov-1\u0022,\u0022TitleTranslations\u0022:[\r{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1033,\u0022Value\u0022:\u0022prov-1\u0022\r},{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1043,\u0022Value\u0022:\u0022Teamsite\u0022\r},{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1031,\u0022Value\u0022:\u0022Teamwebsite\u0022\r},{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1036,\u0022Value\u0022:\u0022Site d\\u2019\\u00e9quipe\u0022\r}\r],\u0022Url\u0022:\u0022https:\\u002f\\u002fbertonline.sharepoint.com\\u002fsites\\u002fprov-1\u0022,\u0022UserCodeMaximumLevel\u0022:300,\u0022UserCodeWarningLevel\u0022:200,\u0022WebsCount\u0022:5\r}\r]"}
\ No newline at end of file
+{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1eae30a0-00d6-3000-e36d-73d7dc39da3f","SPClientServiceRequestDuration":"593","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"[\r{\r\u0022SchemaVersion\u0022:\u002215.0.0.0\u0022,\u0022LibraryVersion\u0022:\u002216.0.22316.12004\u0022,\u0022ErrorInfo\u0022:null,\u0022TraceCorrelationId\u0022:\u00221eae30a0-00d6-3000-e36d-73d7dc39da3f\u0022\r},4,{\r\u0022IsNull\u0022:false\r},5,{\r\u0022IsNull\u0022:false\r},2,{\r\u0022_ObjectType_\u0022:\u0022Microsoft.Online.SharePoint.TenantAdministration.SiteProperties\u0022,\u0022_ObjectIdentity_\u0022:\u00221eae30a0-00d6-3000-e36d-73d7dc39da3f|908bed80-a04a-4433-b4a0-883d9847d110:6492ece7-7f5d-4499-8130-50e761e25bd9\\nSiteProperties\\nhttps%3a%2f%2fbertonline.sharepoint.com%2fsites%2fprov-1\u0022,\u0022AllowDownloadingNonWebViewableFiles\u0022:false,\u0022AllowEditing\u0022:true,\u0022AllowSelfServiceUpgrade\u0022:true,\u0022AnonymousLinkExpirationInDays\u0022:0,\u0022AuthContextStrength\u0022:null,\u0022AuthenticationContextName\u0022:null,\u0022AverageResourceUsage\u0022:0,\u0022BlockDownloadLinksFileType\u0022:1,\u0022BlockDownloadMicrosoft365GroupIds\u0022:null,\u0022BlockDownloadPolicy\u0022:false,\u0022CommentsOnSitePagesDisabled\u0022:false,\u0022CompatibilityLevel\u0022:15,\u0022ConditionalAccessPolicy\u0022:0,\u0022CurrentResourceUsage\u0022:0,\u0022DefaultLinkPermission\u0022:0,\u0022DefaultLinkToExistingAccess\u0022:false,\u0022DefaultLinkToExistingAccessReset\u0022:false,\u0022DefaultSharingLinkType\u0022:0,\u0022DenyAddAndCustomizePages\u0022:2,\u0022Description\u0022:\u0022prov-1\u0022,\u0022DisableAppViews\u0022:2,\u0022DisableCompanyWideSharingLinks\u0022:2,\u0022DisableFlows\u0022:2,\u0022ExcludedBlockDownloadGroupIds\u0022:null,\u0022ExternalUserExpirationInDays\u0022:0,\u0022GroupId\u0022:\u0022\\/Guid(b32780e9-df70-4548-a735-4e7f055415a1)\\/\u0022,\u0022GroupOwnerLoginName\u0022:\u0022c:0o.c|federateddirectoryclaimprovider|b32780e9-df70-4548-a735-4e7f055415a1_o\u0022,\u0022HasHolds\u0022:false,\u0022HubSiteId\u0022:\u0022\\/Guid(00000000-0000-0000-0000-000000000000)\\/\u0022,\u0022IBMode\u0022:\u0022\u0022,\u0022IBSegments\u0022:[\r\r],\u0022IBSegmentsToAdd\u0022:null,\u0022IBSegmentsToRemove\u0022:null,\u0022IsGroupOwnerSiteAdmin\u0022:true,\u0022IsHubSite\u0022:false,\u0022IsTeamsChannelConnected\u0022:false,\u0022IsTeamsConnected\u0022:true,\u0022LastContentModifiedDate\u0022:\u0022\\/Date(2022,2,29,9,40,58,397)\\/\u0022,\u0022Lcid\u0022:2067,\u0022LimitedAccessFileType\u0022:1,\u0022LockIssue\u0022:null,\u0022LockState\u0022:\u0022Unlock\u0022,\u0022LoopDefaultSharingLinkRole\u0022:0,\u0022LoopDefaultSharingLinkScope\u0022:-1,\u0022LoopOverrideSharingCapability\u0022:false,\u0022LoopSharingCapability\u0022:1,\u0022MediaTranscription\u0022:0,\u0022OverrideBlockUserInfoVisibility\u0022:0,\u0022OverrideTenantAnonymousLinkExpirationPolicy\u0022:false,\u0022OverrideTenantExternalUserExpirationPolicy\u0022:false,\u0022Owner\u0022:\u0022b32780e9-df70-4548-a735-4e7f055415a1_o\u0022,\u0022OwnerEmail\u0022:\u0022prov-1@bertonline.onmicrosoft.com\u0022,\u0022OwnerLoginName\u0022:\u0022c:0o.c|federateddirectoryclaimprovider|b32780e9-df70-4548-a735-4e7f055415a1_o\u0022,\u0022OwnerName\u0022:\u0022prov-1\u0022,\u0022PWAEnabled\u0022:1,\u0022ReadOnlyAccessPolicy\u0022:false,\u0022RelatedGroupId\u0022:\u0022\\/Guid(b32780e9-df70-4548-a735-4e7f055415a1)\\/\u0022,\u0022RestrictedToRegion\u0022:3,\u0022SandboxedCodeActivationCapability\u0022:2,\u0022SensitivityLabel\u0022:\u0022\\/Guid(00000000-0000-0000-0000-000000000000)\\/\u0022,\u0022SensitivityLabel2\u0022:\u0022\u0022,\u0022SetOwnerWithoutUpdatingSecondaryAdmin\u0022:false,\u0022SharingAllowedDomainList\u0022:\u0022\u0022,\u0022SharingBlockedDomainList\u0022:\u0022\u0022,\u0022SharingCapability\u0022:1,\u0022SharingDomainRestrictionMode\u0022:0,\u0022SharingLockDownCanBeCleared\u0022:true,\u0022SharingLockDownEnabled\u0022:false,\u0022ShowPeoplePickerSuggestionsForGuestUsers\u0022:false,\u0022SiteDefinedSharingCapability\u0022:1,\u0022SocialBarOnSitePagesDisabled\u0022:false,\u0022Status\u0022:\u0022Active\u0022,\u0022StorageMaximumLevel\u0022:26214400,\u0022StorageQuotaType\u0022:null,\u0022StorageUsage\u0022:4464,\u0022StorageWarningLevel\u0022:25574400,\u0022TeamsChannelType\u0022:0,\u0022Template\u0022:\u0022GROUP#0\u0022,\u0022TimeZoneId\u0022:3,\u0022Title\u0022:\u0022prov-1\u0022,\u0022TitleTranslations\u0022:[\r{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1033,\u0022Value\u0022:\u0022prov-1\u0022\r},{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1043,\u0022Value\u0022:\u0022Teamsite\u0022\r},{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1031,\u0022Value\u0022:\u0022Teamwebsite\u0022\r},{\r\u0022_ObjectType_\u0022:\u0022SP.SPResourceEntry\u0022,\u0022LCID\u0022:1036,\u0022Value\u0022:\u0022Site d\\u2019\\u00e9quipe\u0022\r}\r],\u0022Url\u0022:\u0022https:\\u002f\\u002fbertonline.sharepoint.com\\u002fsites\\u002fprov-1\u0022,\u0022UserCodeMaximumLevel\u0022:300,\u0022UserCodeWarningLevel\u0022:200,\u0022WebsCount\u0022:5\r}\r]"}
\ No newline at end of file
diff --git a/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/CSOMResponseHelperTests.cs b/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/CSOMResponseHelperTests.cs
index eecc2f108f..de64c33f61 100644
--- a/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/CSOMResponseHelperTests.cs
+++ b/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/CSOMResponseHelperTests.cs
@@ -28,7 +28,7 @@ public void TestProcessResponse()
Assert.AreEqual("Dev", response.Title);
Assert.AreEqual(Guid.Parse("a5355253-94a1-48f1-ada4-da51338c3a5b"), response.Id);
- DateTime expectedDate = new DateTime(2019, 11, 5, 17, 7, 26, 0);
+ DateTime expectedDate = new DateTime(2019, 12, 5, 17, 7, 26, 0);
Assert.AreEqual(expectedDate, response.Created);
DateTime expectedLastItemModifiedDate = new DateTime(2021, 2, 5, 14, 11, 59, 0);
diff --git a/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/DateConvertStrategyTests.cs b/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/DateConvertStrategyTests.cs
index 14d83a0af8..76b27ad163 100644
--- a/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/DateConvertStrategyTests.cs
+++ b/src/sdk/PnP.Core.Test/Services/Core/CSOM/Utils/DateConvertStrategyTests.cs
@@ -1,5 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PnP.Core.Services.Core.CSOM.Utils.DateHelpers;
+using PnP.Core.Test.Utilities;
using System;
namespace PnP.Core.Test.Services.Core.CSOM.Utils
@@ -7,31 +8,47 @@ namespace PnP.Core.Test.Services.Core.CSOM.Utils
[TestClass]
public class DateConvertStrategyTests
{
+
[TestMethod]
- public void TestParsingDateFromConstructorLikeString()
+ public void TestParsingFromDateTimeStrategy1()
{
- DateConstuctorStrategy strategy = new DateConstuctorStrategy();
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
string inputString = "/Date(2019,11,5,17,7,26,0)/";
- DateTime expectedDate = new DateTime(2019, 11, 5, 17, 7, 26, 0);
+ DateTime expectedDate = new DateTime(2019, 12, 5, 17, 7, 26, 0);
DateTime? actualDate = strategy.ConverDate(inputString);
Assert.AreEqual(expectedDate, actualDate);
}
+
[TestMethod]
- public void TestParsingDateFromConstructorLikeString_Negative()
+ public void TestParsingFromDateTimeStrategy2()
{
- DateConstuctorStrategy strategy = new DateConstuctorStrategy();
- string inputString = "/Date(1612534319000)/";
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(2022,0,5,17,7,26,0)/";
+ DateTime expectedDate = new DateTime(2022, 1, 5, 17, 7, 26, 0);
DateTime? actualDate = strategy.ConverDate(inputString);
- Assert.IsFalse(actualDate.HasValue);
+ Assert.AreEqual(expectedDate, actualDate);
+ }
+
+ [TestMethod]
+ public void TestParsingFromDateTimeStrategy3()
+ {
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(2022,2,29,9,40,58,397)/";
+
+ DateTime expectedDate = new DateTime(2022, 3, 29, 9, 40, 58, 397);
+ DateTime? actualDate = strategy.ConverDate(inputString);
+
+ Assert.AreEqual(expectedDate, actualDate);
}
+
[TestMethod]
- public void TestParsingDateFromMiliseconds()
+ public void TestParsingFromDateTimeStrategy4()
{
- FromMilisecondsConversionStrategy strategy = new FromMilisecondsConversionStrategy();
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
string inputString = "/Date(1612534319000)/";
DateTime expectedDate = new DateTime(2021, 2, 5, 14, 11, 59, 0);
@@ -39,37 +56,100 @@ public void TestParsingDateFromMiliseconds()
Assert.AreEqual(expectedDate, actualDate);
}
+
[TestMethod]
- public void TestParsingDateFromMiliseconds_Negative()
+ public void TestParsingFromDateTimeStrategy5()
{
- FromMilisecondsConversionStrategy strategy = new FromMilisecondsConversionStrategy();
- string inputString = "/Date(2019,11,5,17,7,26,0)/";
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(-50827680000)/";
+ DateTime expectedDate = new DateTime(1968, 5, 22, 17, 12, 0, 0);
DateTime? actualDate = strategy.ConverDate(inputString);
- Assert.IsFalse(actualDate.HasValue);
+ Assert.AreEqual(expectedDate, actualDate);
}
+
[TestMethod]
- public void CSOMDateConverter_Test_FromConstructor()
+ public void TestParsingFromDateTimeStrategy6()
{
- CSOMDateConverter converter = new CSOMDateConverter();
- string inputString = "/Date(2019,11,5,17,7,26,0)/";
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(1243037520000-0700)/";
- DateTime expectedDate = new DateTime(2019, 11, 5, 17, 7, 26, 0);
- DateTime? actualDate = converter.ConverDate(inputString);
+ DateTime expectedDate = new DateTime(2009, 5, 23, 0, 12, 0, 0, DateTimeKind.Utc).ToLocalTime();
+ DateTime? actualDate = strategy.ConverDate(inputString);
Assert.AreEqual(expectedDate, actualDate);
}
+
[TestMethod]
- public void CSOMDateConverter_Test_FromMiliseconds()
+ public void TestParsingFromDateTimeStrategy7()
{
- CSOMDateConverter converter = new CSOMDateConverter();
- string inputString = "/Date(1612534319000)/";
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(1243037520000+0300)/";
- DateTime expectedDate = new DateTime(2021, 2, 5, 14, 11, 59, 0);
- DateTime? actualDate = converter.ConverDate(inputString);
+ DateTime expectedDate = new DateTime(2009, 5, 23, 0, 12, 0, 0, DateTimeKind.Utc).ToLocalTime();
+ DateTime? actualDate = strategy.ConverDate(inputString);
- Assert.AreEqual(expectedDate, actualDate);
+ if (!TestCommon.RunningInGitHubWorkflow())
+ {
+ Assert.AreEqual(expectedDate, actualDate);
+ }
+ }
+
+ [TestMethod]
+ public void TestParsingFromDateTimeStrategy8()
+ {
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(1243037520000)/";
+
+ DateTime expectedDate = new DateTime(2009, 5, 23, 0, 12, 0, 0, DateTimeKind.Utc);
+ DateTime? actualDate = strategy.ConverDate(inputString);
+
+ if (!TestCommon.RunningInGitHubWorkflow())
+ {
+ Assert.AreEqual(expectedDate, actualDate);
+ }
+ }
+
+ [TestMethod]
+ public void TestParsingFromDateTimeStrategyNegative1()
+ {
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "";
+
+ DateTime? actualDate = strategy.ConverDate(inputString);
+
+ Assert.IsFalse(actualDate.HasValue);
+ }
+
+ [TestMethod]
+ [ExpectedException(typeof(FormatException))]
+ public void TestParsingFromDateTimeStrategyNegative2()
+ {
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(2019,11,A,17,7,26,0)/";
+
+ strategy.ConverDate(inputString);
+ }
+
+ [TestMethod]
+ [ExpectedException(typeof(FormatException))]
+ public void TestParsingFromDateTimeStrategyNegative3()
+ {
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(2019,11,5,17,7,26,0,888)/";
+
+ strategy.ConverDate(inputString);
+ }
+
+ [TestMethod]
+ [ExpectedException(typeof(ArgumentOutOfRangeException))]
+ public void TestParsingFromDateTimeStrategyNegative4()
+ {
+ FromDateTimeStrategy strategy = new FromDateTimeStrategy();
+ string inputString = "/Date(2022,12,29,9,40,58,397)/";
+
+ strategy.ConverDate(inputString);
}
}
}
diff --git a/src/sdk/PnP.Core/PnPCoreResources.Designer.cs b/src/sdk/PnP.Core/PnPCoreResources.Designer.cs
index a19cc3aaef..88876eefdf 100644
--- a/src/sdk/PnP.Core/PnPCoreResources.Designer.cs
+++ b/src/sdk/PnP.Core/PnPCoreResources.Designer.cs
@@ -141,6 +141,15 @@ internal static string Exception_CreatePnPContext_GroupId {
}
}
+ ///
+ /// Looks up a localized string similar to Provided CSOM datetime ({0}) is malformed.
+ ///
+ internal static string Exception_CSOM_MalformedDateTime {
+ get {
+ return ResourceManager.GetString("Exception_CSOM_MalformedDateTime", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Feature was already activated.
///
diff --git a/src/sdk/PnP.Core/PnPCoreResources.resx b/src/sdk/PnP.Core/PnPCoreResources.resx
index 541b4bd9f8..7c23a84607 100644
--- a/src/sdk/PnP.Core/PnPCoreResources.resx
+++ b/src/sdk/PnP.Core/PnPCoreResources.resx
@@ -144,6 +144,9 @@
Please provide the id (Guid) of a the Microsoft 365 group you want to create a PnPContext for
+
+ Provided CSOM datetime ({0}) is malformed
+
Feature was already activated
diff --git a/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/CSOMDateConverter.cs b/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/CSOMDateConverter.cs
index c4590f95ef..1e021a90ed 100644
--- a/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/CSOMDateConverter.cs
+++ b/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/CSOMDateConverter.cs
@@ -7,8 +7,7 @@ internal sealed class CSOMDateConverter : IDateConversionStrategy
{
internal List AvailableConverters { get; set; } = new List()
{
- new DateConstuctorStrategy(),
- new FromMilisecondsConversionStrategy()
+ new FromDateTimeStrategy()
};
public DateTime? ConverDate(string dateValue)
diff --git a/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/DateConstuctorStrategy.cs b/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/DateConstuctorStrategy.cs
deleted file mode 100644
index 3714f30d8a..0000000000
--- a/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/DateConstuctorStrategy.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-
-namespace PnP.Core.Services.Core.CSOM.Utils.DateHelpers
-{
- internal sealed class DateConstuctorStrategy : IDateConversionStrategy
- {
- public DateTime? ConverDate(string dateValue)
- {
- DateTime? result = null;
- string[] constructorValues = dateValue.Replace("/Date(", "").Replace(")/", "").Split(',');
- if (constructorValues.Length == 7)
- {
- if (constructorValues[0] == "1" || constructorValues[0] == "0")
- {
- // For dates returned as "/Date(1,0,1,0,0,0,0)/"
- return DateTime.MinValue;
- }
-
- // CSOM request is was returning Date(2022,0,3,13,32,4,77) as of 2022...service bug?
- // Creating a new DateTime with month 0 will fail (see #703)
- if (constructorValues[1] == "0")
- {
- return DateTime.MinValue;
- }
-
- try
- {
- result = new DateTime(
- Convert.ToInt32(constructorValues[0]),
- Convert.ToInt32(constructorValues[1]),
- Convert.ToInt32(constructorValues[2]),
- Convert.ToInt32(constructorValues[3]),
- Convert.ToInt32(constructorValues[4]),
- Convert.ToInt32(constructorValues[5]),
- Convert.ToInt32(constructorValues[6]));
- }
- catch(ArgumentOutOfRangeException)
- {
- // Additional safety measure as CSOM sometimes throws invalid datatime information, see #803
- return DateTime.MinValue;
- }
- }
- return result;
- }
- }
-}
diff --git a/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/FromDateTimeStrategy.cs b/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/FromDateTimeStrategy.cs
new file mode 100644
index 0000000000..64516d2917
--- /dev/null
+++ b/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/FromDateTimeStrategy.cs
@@ -0,0 +1,175 @@
+using System;
+
+namespace PnP.Core.Services.Core.CSOM.Utils.DateHelpers
+{
+ internal sealed class FromDateTimeStrategy : IDateConversionStrategy
+ {
+ internal static readonly long MinDateTimeTicks = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
+
+ ///
+ /// CSOM Date format: https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-csom/2edd9d2a-2706-4703-9d27-81d1d7aca699
+ /// Implementation is aligned with what is used inside the CSOM code base
+ ///
+ /// CSOM string date format to parse
+ ///
+ public DateTime? ConverDate(string dateValue)
+ {
+ DateTime? result = null;
+
+ long[] m_dateTimeComponents = new long[7];
+ char[] m_dateTimeSigns = new char[7];
+ char[] m_dateTimeHhmm = new char[4];
+
+ if (string.IsNullOrEmpty(dateValue))
+ {
+ return result;
+ }
+
+ dateValue = dateValue.Replace("/Date(", "").Replace(")/", "");
+
+ int part;
+
+ // the + or - of for the HHMM
+ char hhmmSign = '\0';
+ // whether the current position is in the HHMM
+ bool inHHMM = false;
+
+ // whether the current position is in the number
+ bool inNumber = false;
+
+ // zero the buffer
+ for (part = 0; part < m_dateTimeComponents.Length; part++)
+ {
+ m_dateTimeComponents[part] = 0;
+ m_dateTimeSigns[part] = '\0';
+ }
+
+ // the index in the HHMM
+ int hhmmIndex;
+ for (hhmmIndex = 0; hhmmIndex < m_dateTimeHhmm.Length; hhmmIndex++)
+ {
+ m_dateTimeHhmm[hhmmIndex] = '\0';
+ }
+
+ // set initial value
+ part = 0;
+ hhmmIndex = 0;
+
+ for (int i = 0; i < dateValue.Length; i++)
+ {
+ switch (dateValue[i])
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (inHHMM)
+ {
+ if (hhmmIndex < m_dateTimeHhmm.Length)
+ {
+ m_dateTimeHhmm[hhmmIndex] = dateValue[i];
+ hhmmIndex++;
+ }
+ else
+ {
+ throw new FormatException(string.Format(PnPCoreResources.Exception_CSOM_MalformedDateTime, dateValue));
+ }
+ }
+ else if (!inNumber)
+ {
+ inNumber = true;
+ }
+ if (inNumber)
+ {
+ m_dateTimeComponents[part] = m_dateTimeComponents[part] * 10 + (dateValue[i] - '0');
+ }
+ break;
+ case '-':
+ case '+':
+ if (inNumber)
+ {
+ if (part == 0)
+ {
+ hhmmSign = dateValue[i];
+ inHHMM = true;
+ inNumber = false;
+ }
+ else
+ {
+ throw new FormatException(string.Format(PnPCoreResources.Exception_CSOM_MalformedDateTime, dateValue));
+ }
+ }
+ else
+ {
+ // it's the begining of the number
+ if (m_dateTimeSigns[part] == '\0')
+ {
+ m_dateTimeSigns[part] = dateValue[i];
+ }
+ else
+ {
+ throw new FormatException(string.Format(PnPCoreResources.Exception_CSOM_MalformedDateTime, dateValue));
+ }
+ }
+ break;
+ case ',':
+ inNumber = false;
+ inHHMM = false;
+ part++;
+ if (part >= m_dateTimeComponents.Length)
+ {
+ throw new FormatException(string.Format(PnPCoreResources.Exception_CSOM_MalformedDateTime, dateValue));
+ }
+ break;
+ case ' ':
+ inNumber = false;
+ inHHMM = false;
+ break;
+ default:
+ throw new FormatException(string.Format(PnPCoreResources.Exception_CSOM_MalformedDateTime, dateValue));
+
+ }
+ }
+
+ for (int index = 0; index < m_dateTimeComponents.Length; index++)
+ {
+ if (m_dateTimeSigns[index] == '-')
+ {
+ m_dateTimeComponents[index] = -m_dateTimeComponents[index];
+ }
+ }
+ if (part == 0)
+ {
+ long ticks = m_dateTimeComponents[0];
+
+ result = new DateTime(ticks * 10000 + MinDateTimeTicks, DateTimeKind.Utc);
+
+ if (hhmmSign != '\0')
+ {
+ // convert it to local time.
+ result = result.Value.ToLocalTime();
+ }
+ }
+ else
+ {
+ result = new DateTime(
+ (int)m_dateTimeComponents[0] /*year*/,
+ (int)m_dateTimeComponents[1] + 1 /*month*/,
+ (int)m_dateTimeComponents[2] /*day*/,
+ (int)m_dateTimeComponents[3] /*hour*/,
+ (int)m_dateTimeComponents[4] /*minute*/,
+ (int)m_dateTimeComponents[5] /*second*/,
+ (int)m_dateTimeComponents[6] /*milliseconds*/,
+ DateTimeKind.Unspecified);
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/FromMilisecondsConversionStrategy.cs b/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/FromMilisecondsConversionStrategy.cs
deleted file mode 100644
index 27748888d3..0000000000
--- a/src/sdk/PnP.Core/Services/Core/CSOM/Utils/DateHelpers/FromMilisecondsConversionStrategy.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-
-namespace PnP.Core.Services.Core.CSOM.Utils.DateHelpers
-{
- internal sealed class FromMilisecondsConversionStrategy : IDateConversionStrategy
- {
- ///
- /// JS reference date is 1/1/1970, however .NET reference date is 1/1/0001
- ///
- internal DateTime ReferenceDate { get; set; } = new DateTime(1970, 1, 1);
-
- public DateTime? ConverDate(string dateValue)
- {
- DateTime? result = null;
-
- if (long.TryParse(dateValue.Replace("/Date(", "").Replace(")/", ""), out long numberOfMiliseconds))
- {
- TimeSpan timeSpanToAdd = TimeSpan.FromMilliseconds(numberOfMiliseconds);
- return ReferenceDate + timeSpanToAdd;
- }
- return result;
- }
- }
-}