From f440cc9200be85387c31e37372bbf35eea220601 Mon Sep 17 00:00:00 2001 From: bjansen Date: Fri, 26 Jul 2024 13:43:12 +0200 Subject: [PATCH] Merge of #1494. Thanks @reshmee011 --- src/sdk/CHANGELOG.md | 8 +++ ...nkWithExpirationTest-0-00000.response.json | 1 + ...nkWithExpirationTest-0-00001.response.json | 1 + ...nkWithExpirationTest-0-00002.response.json | 1 + ...nkWithExpirationTest-0-00003.response.json | 1 + ...nkWithExpirationTest-0-00004.response.json | 1 + ...nkWithExpirationTest-1-00000.response.json | 1 + ...nkWithExpirationTest-1-00001.response.json | 1 + ...nkWithExpirationTest-1-00002.response.json | 1 + ...nkWithExpirationTest-1-00003.response.json | 1 + ...nkWithExpirationTest-1-00004.response.json | 1 + ...nkWithExpirationTest-1-00005.response.json | 1 + ...ationalLinkWithExpirationTest-1.properties | 1 + ...nkWithExpirationTest-2-00000.response.json | 1 + ...nkWithExpirationTest-2-00001.response.json | 1 + ...nkWithExpirationTest-2-00002.response.json | 1 + ...nkWithExpirationTest-2-00003.response.json | 1 + .../PnP.Core.Test/Security/PermissionTests.cs | 50 +++++++++++++++++++ 18 files changed, 74 insertions(+) create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00003.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00004.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00003.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00004.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00005.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1.properties create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00003.response.json diff --git a/src/sdk/CHANGELOG.md b/src/sdk/CHANGELOG.md index ff1574b058..931d0fae78 100644 --- a/src/sdk/CHANGELOG.md +++ b/src/sdk/CHANGELOG.md @@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Added + +### Changed + +- Added ExpirationDataTime to OrganizationLinkOptions #1494 [reshmee011 - Reshmee Auckloo] + ## [1.13] ### Added diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00000.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00000.response.json new file mode 100644 index 0000000000..2617baf0bf --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1c1040a1-50e7-9000-9d6e-dc3706a39ea1","SPClientServiceRequestDuration":"668","X-SharePointHealthScore":"1","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:\u00222c99a486-d6c9-4a4b-8d6f-a9faa364c92c\u0022,\u0022Url\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00001.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00001.response.json new file mode 100644 index 0000000000..25b08cbc85 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1d1040a1-c028-9000-9d6e-d20e8da00613","SPClientServiceRequestDuration":"12","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u0022d40d729b-df60-4b57-ac8f-102595090e0a\u0022,\u0022Id\u0022:\u0022f92f9e40-1110-43ef-aa0e-0822e13fb7ba\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00002.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00002.response.json new file mode 100644 index 0000000000..36247fcce3 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1d1040a1-6038-9000-9d6e-d46406bafea4","SPClientServiceRequestDuration":"74","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022AllowContentTypes\u0022:true,\u0022BaseTemplate\u0022:101,\u0022BaseType\u0022:1,\u0022ContentTypesEnabled\u0022:false,\u0022CrawlNonDefaultViews\u0022:false,\u0022Created\u0022:\u00222021-09-11T23:42:33Z\u0022,\u0022CurrentChangeToken\u0022:{\u0022StringValue\u0022:\u00221;3;13326e70-58ba-4e0e-9b30-08189f21d555;638575906536070000;894805328\u0022},\u0022DefaultContentApprovalWorkflowId\u0022:\u002200000000-0000-0000-0000-000000000000\u0022,\u0022DefaultItemOpenUseListSetting\u0022:false,\u0022Description\u0022:\u0022\u0022,\u0022Direction\u0022:\u0022none\u0022,\u0022DisableCommenting\u0022:false,\u0022DisableGridEditing\u0022:false,\u0022DocumentTemplateUrl\u0022:\u0022/sites/prov-2/Shared Documents/Forms/template.dotx\u0022,\u0022DraftVersionVisibility\u0022:0,\u0022EnableAttachments\u0022:false,\u0022EnableFolderCreation\u0022:true,\u0022EnableMinorVersions\u0022:false,\u0022EnableModeration\u0022:false,\u0022EnableRequestSignOff\u0022:true,\u0022EnableVersioning\u0022:true,\u0022EntityTypeName\u0022:\u0022Shared_x0020_Documents\u0022,\u0022ExemptFromBlockDownloadOfNonViewableFiles\u0022:false,\u0022FileSavePostProcessingEnabled\u0022:false,\u0022ForceCheckout\u0022:false,\u0022HasExternalDataSource\u0022:false,\u0022Hidden\u0022:false,\u0022Id\u0022:\u002213326e70-58ba-4e0e-9b30-08189f21d555\u0022,\u0022ImagePath\u0022:{\u0022DecodedUrl\u0022:\u0022/_layouts/15/images/itdl.png?rev=47\u0022},\u0022ImageUrl\u0022:\u0022/_layouts/15/images/itdl.png?rev=47\u0022,\u0022DefaultSensitivityLabelForLibrary\u0022:\u0022\u0022,\u0022SensitivityLabelToEncryptOnDownloadForLibrary\u0022:null,\u0022IrmEnabled\u0022:false,\u0022IrmExpire\u0022:false,\u0022IrmReject\u0022:false,\u0022IsApplicationList\u0022:false,\u0022IsCatalog\u0022:false,\u0022IsPrivate\u0022:false,\u0022ItemCount\u0022:5,\u0022LastItemDeletedDate\u0022:\u00222024-03-29T17:58:14Z\u0022,\u0022LastItemModifiedDate\u0022:\u00222024-03-29T17:58:14Z\u0022,\u0022LastItemUserModifiedDate\u0022:\u00222024-03-29T17:58:14Z\u0022,\u0022ListExperienceOptions\u0022:1,\u0022ListItemEntityTypeFullName\u0022:\u0022SP.Data.Shared_x0020_DocumentsItem\u0022,\u0022MajorVersionLimit\u0022:500,\u0022MajorWithMinorVersionsLimit\u0022:0,\u0022MultipleDataList\u0022:false,\u0022NoCrawl\u0022:false,\u0022ParentWebPath\u0022:{\u0022DecodedUrl\u0022:\u0022/sites/prov-2\u0022},\u0022ParentWebUrl\u0022:\u0022/sites/prov-2\u0022,\u0022ParserDisabled\u0022:false,\u0022ServerTemplateCanCreateFolders\u0022:true,\u0022TemplateFeatureId\u0022:\u002200bfea71-e717-4e80-aa17-d0c71b360101\u0022,\u0022Title\u0022:\u0022Documents\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00003.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00003.response.json new file mode 100644 index 0000000000..c7ff614ea2 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1d1040a1-d04f-9000-9d6e-d04092236c0b","SPClientServiceRequestDuration":"22","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022Exists\u0022:true,\u0022ExistsAllowThrowForPolicyFailures\u0022:true,\u0022ExistsWithException\u0022:true,\u0022IsWOPIEnabled\u0022:false,\u0022ItemCount\u0022:4,\u0022Name\u0022:\u0022Shared Documents\u0022,\u0022ProgID\u0022:null,\u0022ServerRelativeUrl\u0022:\u0022/sites/prov-2/Shared Documents\u0022,\u0022TimeCreated\u0022:\u00222021-09-11T23:42:33Z\u0022,\u0022TimeLastModified\u0022:\u00222024-03-29T17:58:14Z\u0022,\u0022UniqueId\u0022:\u0022ee07fd66-8537-446f-a7d8-9fd90393188f\u0022,\u0022WelcomePage\u0022:\u0022\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00004.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00004.response.json new file mode 100644 index 0000000000..f1d0895e8f --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-0-00004.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1d1040a1-705f-9000-9d6e-d7ce4701727c","SPClientServiceRequestDuration":"252","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{8E33E161-C40A-4054-8195-7717FF3B2318},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{8E33E161-C40A-4054-8195-7717FF3B2318},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022ExistsAllowThrowForPolicyFailures\u0022:true,\u0022ExistsWithException\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002219823\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2/Shared%20Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx?d=w8e33e161c40a405481957717ff3b2318\u0022,\u0022LinkingUrl\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2/Shared Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx?d=w8e33e161c40a405481957717ff3b2318\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/prov-2/Shared Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx\u0022,\u0022TimeCreated\u0022:\u00222024-07-26T11:37:35Z\u0022,\u0022TimeLastModified\u0022:\u00222024-07-26T11:37:35Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u00228e33e161-c40a-4054-8195-7717ff3b2318\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00000.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00000.response.json new file mode 100644 index 0000000000..cc50dc9b21 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1d1040a1-b07e-9000-9d6e-dfa940377ba2","SPClientServiceRequestDuration":"13","X-SharePointHealthScore":"3","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:\u00222c99a486-d6c9-4a4b-8d6f-a9faa364c92c\u0022,\u0022Url\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00001.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00001.response.json new file mode 100644 index 0000000000..da474c6f70 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1d1040a1-508d-9000-9d6e-d3d8b5ab6a5e","SPClientServiceRequestDuration":"16","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u0022d40d729b-df60-4b57-ac8f-102595090e0a\u0022,\u0022Id\u0022:\u0022f92f9e40-1110-43ef-aa0e-0822e13fb7ba\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00002.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00002.response.json new file mode 100644 index 0000000000..75ab4161f9 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"1f1040a1-904e-9000-9d6e-db4ce86cfa48","SPClientServiceRequestDuration":"18","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{8E33E161-C40A-4054-8195-7717FF3B2318},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{8E33E161-C40A-4054-8195-7717FF3B2318},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022ExistsAllowThrowForPolicyFailures\u0022:true,\u0022ExistsWithException\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002219823\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2/Shared%20Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx?d=w8e33e161c40a405481957717ff3b2318\u0022,\u0022LinkingUrl\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2/Shared Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx?d=w8e33e161c40a405481957717ff3b2318\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/prov-2/Shared Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx\u0022,\u0022TimeCreated\u0022:\u00222024-07-26T11:37:35Z\u0022,\u0022TimeLastModified\u0022:\u00222024-07-26T11:37:35Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u00228e33e161-c40a-4054-8195-7717ff3b2318\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00003.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00003.response.json new file mode 100644 index 0000000000..c1136f417a --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"201040a1-607d-9000-9d6e-dd3e40037611","SPClientServiceRequestDuration":"234","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022SiteId\u0022:\u0022f92f9e40-1110-43ef-aa0e-0822e13fb7ba\u0022,\u0022UniqueId\u0022:\u00228e33e161-c40a-4054-8195-7717ff3b2318\u0022,\u0022VroomDriveID\u0022:\u0022b!QJ4v-RAR70OqDggi4T-3uoakmSzJ1ktKjW-p-qNkySxwbjITulgOTpswCBifIdVV\u0022,\u0022VroomItemID\u0022:\u002201O2ADSGLB4EZY4CWEKRAIDFLXC77TWIYY\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00004.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00004.response.json new file mode 100644 index 0000000000..ff0b94a869 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00004.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":201,"Headers":{"Cache-Control":"no-store, no-cache","Transfer-Encoding":"chunked","Location":"https://bertonline.sharepoint.com/_api/v2.0/sites(\u0027f92f9e40-1110-43ef-aa0e-0822e13fb7ba\u0027)/drives(\u0027b!QJ4v-RAR70OqDggi4T-3uoakmSzJ1ktKjW-p-qNkySxwbjITulgOTpswCBifIdVV\u0027)/items(\u002701O2ADSGLB4EZY4CWEKRAIDFLXC77TWIYY\u0027)/permissions(\u002774440e69-e6d6-4a64-88ea-d50136dcc625\u0027)","Vary":"Accept-Encoding","Strict-Transport-Security":"max-age=31536000","request-id":"c46e7e5d-9655-481d-8961-58836458d359","client-request-id":"c46e7e5d-9655-481d-8961-58836458d359","x-ms-ags-diagnostic":"{\u0022ServerInfo\u0022:{\u0022DataCenter\u0022:\u0022West US 3\u0022,\u0022Slice\u0022:\u0022E\u0022,\u0022Ring\u0022:\u00222\u0022,\u0022ScaleUnit\u0022:\u0022000\u0022,\u0022RoleInstance\u0022:\u0022PH1PEPF0001969B\u0022}}","Link":"\u003Chttps://developer.microsoft-tst.com/en-us/graph/changes?$filterby=beta,Removal\u0026from=2021-09-01\u0026to=2021-10-01\u003E;rel=\u0022deprecation\u0022;type=\u0022text/html\u0022,\u003Chttps://developer.microsoft-tst.com/en-us/graph/changes?$filterby=beta,Removal\u0026from=2021-09-01\u0026to=2021-10-01\u003E;rel=\u0022deprecation\u0022;type=\u0022text/html\u0022","Deprecation":"Fri, 03 Sep 2021 23:59:59 GMT","Sunset":"Sun, 01 Oct 2023 23:59:59 GMT","OData-Version":"4.0","Date":"Fri, 26 Jul 2024 11:37:50 GMT"},"Response":"{\u0022@odata.context\u0022:\u0022https://graph.microsoft.com/beta/$metadata#microsoft.graph.permission\u0022,\u0022id\u0022:\u002274440e69-e6d6-4a64-88ea-d50136dcc625\u0022,\u0022roles\u0022:[\u0022write\u0022],\u0022shareId\u0022:\u0022u!aHR0cHM6Ly9iZXJ0b25saW5lLnNoYXJlcG9pbnQuY29tLzp3Oi9zL3Byb3YtMi9FV0hoTTQ0S3hGUkFnWlYzRl84N0l4Z0JBSE4zeVlXQlRoT05JejFwU3N5LTBn\u0022,\u0022expirationDateTime\u0022:\u00222024-07-31T13:37:38Z\u0022,\u0022hasPassword\u0022:false,\u0022link\u0022:{\u0022scope\u0022:\u0022organization\u0022,\u0022type\u0022:\u0022edit\u0022,\u0022webUrl\u0022:\u0022https://bertonline.sharepoint.com/:w:/s/prov-2/EWHhM44KxFRAgZV3F_87IxgBAHN3yYWBThONIz1pSsy-0g\u0022,\u0022preventsDownload\u0022:false}}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00005.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00005.response.json new file mode 100644 index 0000000000..9716b3313d --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1-00005.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"Cache-Control":"no-store, no-cache","Transfer-Encoding":"chunked","Vary":"Accept-Encoding","Strict-Transport-Security":"max-age=31536000","request-id":"cac61c21-ce0e-4857-aac4-c1feaec0c1ea","client-request-id":"cac61c21-ce0e-4857-aac4-c1feaec0c1ea","x-ms-ags-diagnostic":"{\u0022ServerInfo\u0022:{\u0022DataCenter\u0022:\u0022West US 3\u0022,\u0022Slice\u0022:\u0022E\u0022,\u0022Ring\u0022:\u00222\u0022,\u0022ScaleUnit\u0022:\u0022000\u0022,\u0022RoleInstance\u0022:\u0022PH1PEPF0001969B\u0022}}","Link":"\u003Chttps://developer.microsoft-tst.com/en-us/graph/changes?$filterby=beta,Removal\u0026from=2021-09-01\u0026to=2021-10-01\u003E;rel=\u0022deprecation\u0022;type=\u0022text/html\u0022,\u003Chttps://developer.microsoft-tst.com/en-us/graph/changes?$filterby=beta,Removal\u0026from=2021-09-01\u0026to=2021-10-01\u003E;rel=\u0022deprecation\u0022;type=\u0022text/html\u0022","Deprecation":"Fri, 03 Sep 2021 23:59:59 GMT","Sunset":"Sun, 01 Oct 2023 23:59:59 GMT","OData-Version":"4.0","Date":"Fri, 26 Jul 2024 11:38:03 GMT"},"Response":"{\u0022@odata.context\u0022:\u0022https://graph.microsoft.com/beta/$metadata#sites(\u0027f92f9e40-1110-43ef-aa0e-0822e13fb7ba\u0027)/drives(\u0027b%21QJ4v-RAR70OqDggi4T-3uoakmSzJ1ktKjW-p-qNkySxwbjITulgOTpswCBifIdVV\u0027)/items(\u002701O2ADSGLB4EZY4CWEKRAIDFLXC77TWIYY\u0027)/permissions\u0022,\u0022value\u0022:[{\u0022id\u0022:\u002274440e69-e6d6-4a64-88ea-d50136dcc625\u0022,\u0022roles\u0022:[\u0022write\u0022],\u0022shareId\u0022:\u0022u!aHR0cHM6Ly9iZXJ0b25saW5lLnNoYXJlcG9pbnQuY29tLzp3Oi9zL3Byb3YtMi9FV0hoTTQ0S3hGUkFnWlYzRl84N0l4Z0JBSE4zeVlXQlRoT05JejFwU3N5LTBn\u0022,\u0022expirationDateTime\u0022:\u00222024-07-31T13:37:38Z\u0022,\u0022hasPassword\u0022:false,\u0022grantedToIdentitiesV2\u0022:[],\u0022grantedToIdentities\u0022:[],\u0022link\u0022:{\u0022scope\u0022:\u0022organization\u0022,\u0022type\u0022:\u0022edit\u0022,\u0022webUrl\u0022:\u0022https://bertonline.sharepoint.com/:w:/s/prov-2/EWHhM44KxFRAgZV3F_87IxgBAHN3yYWBThONIz1pSsy-0g\u0022,\u0022preventsDownload\u0022:false}}]}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1.properties b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1.properties new file mode 100644 index 0000000000..2bb0d58048 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-1.properties @@ -0,0 +1 @@ +{"Ticks":"638580298584703214"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00000.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00000.response.json new file mode 100644 index 0000000000..74a0ab8050 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"311040a1-0085-9000-9d6e-d420961ad2db","SPClientServiceRequestDuration":"25","X-SharePointHealthScore":"2","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:\u00222c99a486-d6c9-4a4b-8d6f-a9faa364c92c\u0022,\u0022Url\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00001.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00001.response.json new file mode 100644 index 0000000000..570db8fa21 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"311040a1-9095-9000-9d6e-d134a389d884","SPClientServiceRequestDuration":"15","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u0022d40d729b-df60-4b57-ac8f-102595090e0a\u0022,\u0022Id\u0022:\u0022f92f9e40-1110-43ef-aa0e-0822e13fb7ba\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00002.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00002.response.json new file mode 100644 index 0000000000..5a37f28fa8 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"311040a1-40a4-9000-9d6e-d0487ee321b9","SPClientServiceRequestDuration":"16","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{8E33E161-C40A-4054-8195-7717FF3B2318},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{8E33E161-C40A-4054-8195-7717FF3B2318},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022ExistsAllowThrowForPolicyFailures\u0022:true,\u0022ExistsWithException\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002219823\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2/Shared%20Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx?d=w8e33e161c40a405481957717ff3b2318\u0022,\u0022LinkingUrl\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2/Shared Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx?d=w8e33e161c40a405481957717ff3b2318\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/prov-2/Shared Documents/PNP_SDK_TEST_ShareFileOrganizationalLinkWithExpirationTest.docx\u0022,\u0022TimeCreated\u0022:\u00222024-07-26T11:37:35Z\u0022,\u0022TimeLastModified\u0022:\u00222024-07-26T11:37:35Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u00228e33e161-c40a-4054-8195-7717ff3b2318\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00003.response.json b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00003.response.json new file mode 100644 index 0000000000..d5e249c1f2 --- /dev/null +++ b/src/sdk/PnP.Core.Test/Security/MockData/PermissionTests/ShareFileOrganizationalLinkWithExpirationTest-2-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"311040a1-e0b2-9000-9d6e-dac660071cbb","SPClientServiceRequestDuration":"333","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":""} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/Security/PermissionTests.cs b/src/sdk/PnP.Core.Test/Security/PermissionTests.cs index 1c3aa8bf4f..1fcb35bc66 100644 --- a/src/sdk/PnP.Core.Test/Security/PermissionTests.cs +++ b/src/sdk/PnP.Core.Test/Security/PermissionTests.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Security; using System.Threading.Tasks; namespace PnP.Core.Test.Security @@ -419,6 +420,55 @@ await Assert.ThrowsExceptionAsync(async () => await TestAssets.CleanupTestDocumentAsync(2); } + [TestMethod] + public async Task ShareFileOrganizationalLinkWithExpirationTest() + { + //TestCommon.Instance.Mocking = false; + + try + { + (_, _, string documentUrl) = await TestAssets.CreateTestDocumentAsync(0); + + using (var context = await TestCommon.Instance.GetContextAsync(TestCommon.TestSite, 1)) + { + + // Set expiration date + DateTime expirationDate = DateTime.MinValue; + if (!TestCommon.Instance.Mocking) + { + expirationDate = DateTime.Now.AddDays(5); + Dictionary properties = new Dictionary + { + { "Ticks", expirationDate.Ticks.ToString() }, + }; + TestManager.SaveProperties(context, properties); + } + else + { + var properties = TestManager.GetProperties(context); + expirationDate = new DateTime(long.Parse(properties["Ticks"])); + } + + var file = await context.Web.GetFileByServerRelativeUrlAsync(documentUrl); + var shareLinkRequestOptions = new OrganizationalLinkOptions() + { + Type = ShareType.Edit, + ExpirationDateTime = expirationDate + }; + + var sharingLink = await file.CreateOrganizationalSharingLinkAsync(shareLinkRequestOptions); + Assert.AreEqual(sharingLink.ExpirationDateTime.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture), shareLinkRequestOptions.ExpirationDateTime.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture)); + + var newSharingLinks = await file.GetShareLinksAsync(); + Assert.AreEqual(newSharingLinks.AsRequested().First().ExpirationDateTime.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture), shareLinkRequestOptions.ExpirationDateTime.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture)); + } + } + finally + { + await TestAssets.CleanupTestDocumentAsync(2); + } + } + [TestMethod] public async Task ShareFileOrganizationalLinkCreateOnlyExceptionTest() {