From 29cbf9f069c8d7069c82b0861ae226702854a1b0 Mon Sep 17 00:00:00 2001 From: Mathijs Verbeeck Date: Sun, 19 Jun 2022 17:03:39 +0200 Subject: [PATCH] Added functionality for getting a preview of an IFile --- .../PnP.Core.Test/SharePoint/FilesTests.cs | 46 ++++++++++++++ ...FilePreviewAsyncTest-0-00000.response.json | 1 + ...FilePreviewAsyncTest-0-00001.response.json | 1 + ...FilePreviewAsyncTest-0-00002.response.json | 1 + ...FilePreviewAsyncTest-0-00003.response.json | 1 + ...FilePreviewAsyncTest-0-00004.response.json | 1 + ...FilePreviewAsyncTest-1-00000.response.json | 1 + ...FilePreviewAsyncTest-1-00001.response.json | 1 + ...FilePreviewAsyncTest-1-00002.response.json | 1 + ...FilePreviewAsyncTest-1-00003.response.json | 1 + ...FilePreviewAsyncTest-1-00004.response.json | 1 + ...FilePreviewAsyncTest-2-00000.response.json | 1 + ...FilePreviewAsyncTest-2-00001.response.json | 1 + ...FilePreviewAsyncTest-2-00002.response.json | 1 + ...FilePreviewAsyncTest-2-00003.response.json | 1 + ...PageAndZoomAsyncTest-0-00000.response.json | 1 + ...PageAndZoomAsyncTest-0-00001.response.json | 1 + ...PageAndZoomAsyncTest-0-00002.response.json | 1 + ...PageAndZoomAsyncTest-0-00003.response.json | 1 + ...PageAndZoomAsyncTest-0-00004.response.json | 1 + ...PageAndZoomAsyncTest-1-00000.response.json | 1 + ...PageAndZoomAsyncTest-1-00001.response.json | 1 + ...PageAndZoomAsyncTest-1-00002.response.json | 1 + ...PageAndZoomAsyncTest-1-00003.response.json | 1 + ...PageAndZoomAsyncTest-1-00004.response.json | 1 + ...PageAndZoomAsyncTest-2-00000.response.json | 1 + ...PageAndZoomAsyncTest-2-00001.response.json | 1 + ...PageAndZoomAsyncTest-2-00002.response.json | 1 + ...PageAndZoomAsyncTest-2-00003.response.json | 1 + .../Model/SharePoint/Core/Internal/File.cs | 61 +++++++++++++++++++ .../SharePoint/Core/Internal/FilePreview.cs | 13 ++++ .../Model/SharePoint/Core/Public/IFile.cs | 22 +++++++ .../SharePoint/Core/Public/IFilePreview.cs | 28 +++++++++ src/sdk/PnP.Core/PnPCoreResources.Designer.cs | 9 +++ src/sdk/PnP.Core/PnPCoreResources.resx | 3 + 35 files changed, 210 insertions(+) create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00003.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00004.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00003.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00004.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00003.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00003.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00004.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00003.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00004.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00000.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00001.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00002.response.json create mode 100644 src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00003.response.json create mode 100644 src/sdk/PnP.Core/Model/SharePoint/Core/Internal/FilePreview.cs create mode 100644 src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFilePreview.cs diff --git a/src/sdk/PnP.Core.Test/SharePoint/FilesTests.cs b/src/sdk/PnP.Core.Test/SharePoint/FilesTests.cs index 089484bf84..c23250ed70 100644 --- a/src/sdk/PnP.Core.Test/SharePoint/FilesTests.cs +++ b/src/sdk/PnP.Core.Test/SharePoint/FilesTests.cs @@ -3107,5 +3107,51 @@ private async Task> AddMockDocumentToMinorVersioni } #endregion + + #region Preview + + [TestMethod] + public async Task GetFilePreviewAsyncTest() + { + //TestCommon.Instance.Mocking = false; + (_, _, string documentUrl) = await TestAssets.CreateTestDocumentAsync(0); + + using (var context = await TestCommon.Instance.GetContextAsync(TestCommon.TestSite, 1)) + { + IFile file = await context.Web.GetFileByServerRelativeUrlAsync(documentUrl); + + Assert.IsNotNull(file); + + var filePreview = await file.GetPreviewAsync(); + + Assert.IsNotNull(filePreview); + Assert.IsNotNull(filePreview.GetUrl); + } + + await TestAssets.CleanupTestDocumentAsync(2); + } + + [TestMethod] + public async Task GetFilePreviewIncludingPageAndZoomAsyncTest() + { + //TestCommon.Instance.Mocking = false; + (_, _, string documentUrl) = await TestAssets.CreateTestDocumentAsync(0); + + using (var context = await TestCommon.Instance.GetContextAsync(TestCommon.TestSite, 1)) + { + IFile file = await context.Web.GetFileByServerRelativeUrlAsync(documentUrl); + + Assert.IsNotNull(file); + + var filePreview = await file.GetPreviewAsync("2", 5); + + Assert.IsNotNull(filePreview); + Assert.IsNotNull(filePreview.GetUrl); + } + + await TestAssets.CleanupTestDocumentAsync(2); + } + + #endregion } } diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00000.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00000.response.json new file mode 100644 index 0000000000..70a2fd771d --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-b031-4000-7f3c-2fd65c2aa49c","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:\u0022ceb5fd80-a434-4a62-a60b-b272f10ba1df\u0022,\u0022Url\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00001.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00001.response.json new file mode 100644 index 0000000000..b57a817f30 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-7041-4000-4c6b-ad7f048c4396","SPClientServiceRequestDuration":"9","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u00220ad55b5d-6a79-467b-ad21-d4bef7948a79\u0022,\u0022Id\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00002.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00002.response.json new file mode 100644 index 0000000000..5230902fd3 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-4049-4000-4767-dec273214604","SPClientServiceRequestDuration":"36","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022value\u0022:[{\u0022AllowContentTypes\u0022:true,\u0022BaseTemplate\u0022:101,\u0022BaseType\u0022:1,\u0022ContentTypesEnabled\u0022:false,\u0022CrawlNonDefaultViews\u0022:false,\u0022Created\u0022:\u00222022-03-06T01:58:24Z\u0022,\u0022CurrentChangeToken\u0022:{\u0022StringValue\u0022:\u00221;3;68e9c7c6-94e1-4422-9eef-ca5a274ee7c6;637912477445700000;503776424\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/pnpcoresdktestgroup/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:\u002268e9c7c6-94e1-4422-9eef-ca5a274ee7c6\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,\u0022IrmEnabled\u0022:false,\u0022IrmExpire\u0022:false,\u0022IrmReject\u0022:false,\u0022IsApplicationList\u0022:false,\u0022IsCatalog\u0022:false,\u0022IsPrivate\u0022:false,\u0022ItemCount\u0022:7,\u0022LastItemDeletedDate\u0022:\u00222022-06-19T15:01:32Z\u0022,\u0022LastItemModifiedDate\u0022:\u00222022-06-19T15:01:32Z\u0022,\u0022LastItemUserModifiedDate\u0022:\u00222022-06-19T15:01:32Z\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/pnpcoresdktestgroup\u0022},\u0022ParentWebUrl\u0022:\u0022/sites/pnpcoresdktestgroup\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/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00003.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00003.response.json new file mode 100644 index 0000000000..4881b97f2f --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-5050-4000-4c6b-aa0d7f3501ca","SPClientServiceRequestDuration":"17","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022Exists\u0022:true,\u0022IsWOPIEnabled\u0022:false,\u0022ItemCount\u0022:7,\u0022Name\u0022:\u0022Shared Documents\u0022,\u0022ProgID\u0022:null,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents\u0022,\u0022TimeCreated\u0022:\u00222022-03-06T01:58:24Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:01:32Z\u0022,\u0022UniqueId\u0022:\u00222a0ba280-7c53-4eb9-a460-2c31576f90a8\u0022,\u0022WelcomePage\u0022:\u0022\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00004.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00004.response.json new file mode 100644 index 0000000000..5a22af56ee --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-0-00004.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-c056-4000-7f3c-232cb62157d4","SPClientServiceRequestDuration":"201","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{7E28289F-63EE-4881-9B96-2BE3928BE3D3},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{7E28289F-63EE-4881-9B96-2BE3928BE3D3},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002218335\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared%20Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx?d=w7e28289f63ee48819b962be3928be3d3\u0022,\u0022LinkingUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx?d=w7e28289f63ee48819b962be3928be3d3\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_GetFilePreviewAsyncTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx\u0022,\u0022TimeCreated\u0022:\u00222022-06-19T15:02:27Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:02:27Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u00227e28289f-63ee-4881-9b96-2be3928be3d3\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00000.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00000.response.json new file mode 100644 index 0000000000..a39e19d2c4 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-9067-4000-4c6b-a0a58acb3ace","SPClientServiceRequestDuration":"12","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:\u0022ceb5fd80-a434-4a62-a60b-b272f10ba1df\u0022,\u0022Url\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00001.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00001.response.json new file mode 100644 index 0000000000..95ed1400b5 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-706b-4000-4767-d2d1cd59e164","SPClientServiceRequestDuration":"13","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u00220ad55b5d-6a79-467b-ad21-d4bef7948a79\u0022,\u0022Id\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00002.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00002.response.json new file mode 100644 index 0000000000..870962629e --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-8072-4000-4c6b-a5d0a5175364","SPClientServiceRequestDuration":"16","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{7E28289F-63EE-4881-9B96-2BE3928BE3D3},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{7E28289F-63EE-4881-9B96-2BE3928BE3D3},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002218335\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared%20Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx?d=w7e28289f63ee48819b962be3928be3d3\u0022,\u0022LinkingUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx?d=w7e28289f63ee48819b962be3928be3d3\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_GetFilePreviewAsyncTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx\u0022,\u0022TimeCreated\u0022:\u00222022-06-19T15:02:27Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:02:27Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u00227e28289f-63ee-4881-9b96-2be3928be3d3\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00003.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00003.response.json new file mode 100644 index 0000000000..04bd9050ae --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-0077-4000-7f3c-27e23a6f3f91","SPClientServiceRequestDuration":"41","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022SiteId\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022,\u0022UniqueId\u0022:\u00227e28289f-63ee-4881-9b96-2be3928be3d3\u0022,\u0022VroomDriveID\u0022:\u0022b!T4-bD44OMEa7ClAUQtubZID9tc40pGJKpguycvELod_Gx-lo4ZQiRJ7vylonTufG\u0022,\u0022VroomItemID\u0022:\u0022013TMHP6U7FAUH53TDQFEJXFRL4OJIXY6T\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00004.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00004.response.json new file mode 100644 index 0000000000..7b25e230ad --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-1-00004.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"Cache-Control":"no-store, no-cache","Transfer-Encoding":"chunked","Location":"https://graph.microsoft.com/","Vary":"Accept-Encoding","Strict-Transport-Security":"max-age=31536000","request-id":"ae6f05fc-1df3-4062-b3de-771046c2dc9d","client-request-id":"ae6f05fc-1df3-4062-b3de-771046c2dc9d","x-ms-ags-diagnostic":"{\u0022ServerInfo\u0022:{\u0022DataCenter\u0022:\u0022North Europe\u0022,\u0022Slice\u0022:\u0022E\u0022,\u0022Ring\u0022:\u00224\u0022,\u0022ScaleUnit\u0022:\u0022003\u0022,\u0022RoleInstance\u0022:\u0022DB1PEPF0001F9C5\u0022}}","OData-Version":"4.0","Date":"Sun, 19 Jun 2022 15:02:27 GMT"},"Response":"{\u0022@odata.context\u0022:\u0022https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.itemPreviewInfo\u0022,\u0022getUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/_layouts/15/embed.aspx?uniqueId=7e28289f-63ee-4881-9b96-2be3928be3d3\u0026access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvbWF0aGlqc2RldjIuc2hhcmVwb2ludC5jb21AZTFkZDQwMjMtYTY1Ni00ODBhLThhMGUtYzFiMWVlYzUxZTFkIiwiaXNzIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwIiwibmJmIjoiMTY1NTY1MDk0NyIsImV4cCI6IjE2NTU2NTEyNDciLCJlbmRwb2ludHVybCI6Ilc2TjhZV2pNWU9QRHhQdmptMW5yUTd3UzBDSXJHb3dvZUMvWUpoeHhJL0k9IiwiZW5kcG9pbnR1cmxMZW5ndGgiOiIxMjkiLCJpc2xvb3BiYWNrIjoiVHJ1ZSIsImNpZCI6IllXVTJaakExWm1NdE1XUm1NeTAwTURZeUxXSXpaR1V0TnpjeE1EUTJZekprWXpsayIsInZlciI6Imhhc2hlZHByb29mdG9rZW4iLCJzaXRlaWQiOiJNR1k1WWpobU5HWXRNR1U0WlMwME5qTXdMV0ppTUdFdE5UQXhORFF5WkdJNVlqWTAiLCJhcHBfZGlzcGxheW5hbWUiOiJQblBDb3JlRGV2IiwiZ2l2ZW5fbmFtZSI6Ik1hdGhpanMiLCJmYW1pbHlfbmFtZSI6IlZlcmJlZWNrIiwiYXBwaWQiOiJhMmJmNzIzZC1hNzUyLTQ4MGQtOTE1OS1lYzk0NDhiMGNmMGMiLCJ0aWQiOiJlMWRkNDAyMy1hNjU2LTQ4MGEtOGEwZS1jMWIxZWVjNTFlMWQiLCJ1cG4iOiJtYXRoaWpzQG1hdGhpanNkZXYyLm9ubWljcm9zb2Z0LmNvbSIsInB1aWQiOiIxMDAzMjAwMDlEODI2N0ZDIiwiY2FjaGVrZXkiOiIwaC5mfG1lbWJlcnNoaXB8MTAwMzIwMDA5ZDgyNjdmY0BsaXZlLmNvbSIsInNjcCI6ImFsbHNpdGVzLmZ1bGxjb250cm9sIGdyb3VwLndyaXRlIGFsbHByb2ZpbGVzLnJlYWQgYWxscHJvZmlsZXMud3JpdGUgdGVybXN0b3JlLndyaXRlIiwidHQiOiIyIiwidXNlUGVyc2lzdGVudENvb2tpZSI6bnVsbCwiaXBhZGRyIjoiNDAuMTI2LjMxLjk5In0.QW9pV291REFOMG9QZGF1Qk85VWtLRmNZVUttak4raGdUMi9keUpWUnhPST0#wopiToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImFrUFRFTzRYU0N4c3hXOTBHMl9Zd1lWRGdIYyJ9.eyJhdWQiOiJ3b3BpL21hdGhpanNkZXYyLnNoYXJlcG9pbnQuY29tQGUxZGQ0MDIzLWE2NTYtNDgwYS04YTBlLWMxYjFlZWM1MWUxZCIsImlzcyI6IjAwMDAwMDAzLTAwMDAtMGZmMS1jZTAwLTAwMDAwMDAwMDAwMEA5MDE0MDEyMi04NTE2LTExZTEtOGVmZi00OTMwNDkyNDAxOWIiLCJuYmYiOiIxNjU1NjUwOTQ3IiwiZXhwIjoiMTY1NTY1MTI0NyIsIm5hbWVpZCI6IjEwMDMyMDAwOWQ4MjY3ZmMiLCJuaWkiOiJ1cm46ZmVkZXJhdGlvbjptaWNyb3NvZnRvbmxpbmUiLCJjYWNoZWtleSI6IjBoLmZ8bWVtYmVyc2hpcHwxMDAzMjAwMDlkODI2N2ZjQGxpdmUuY29tIiwiaXN1c2VyIjoidHJ1ZSIsImlwYWRkciI6IjgxLjI0Ny4yMzUuMTY5IiwidXRpIjoiVk9seXdNMUJGRXV3bmhIVHpnQTdBQSIsImFwcGlkIjoiYTJiZjcyM2QtYTc1Mi00ODBkLTkxNTktZWM5NDQ4YjBjZjBjIiwidGlkIjoiZTFkZDQwMjMtYTY1Ni00ODBhLThhMGUtYzFiMWVlYzUxZTFkIiwid29waV9hcCI6ImFsbHNpdGVzLmZ1bGxjb250cm9sIGdyb3VwLndyaXRlIGFsbHByb2ZpbGVzLnJlYWQgYWxscHJvZmlsZXMud3JpdGUgdGVybXN0b3JlLndyaXRlIiwid29waV90dCI6IlByZUF1dGhUb2tlbiIsImFwcGN0eCI6IjdlMjgyODlmNjNlZTQ4ODE5Yjk2MmJlMzkyOGJlM2QzO01NSW9kVHVrMnhacDRTTFIyUlQ3cU9HcTNsTT07RGVmYXVsdDs7N0ZGRkZGRkZGRkZCRkZGRjtUcnVlOzthMmJmNzIzZC1hNzUyLTQ4MGQtOTE1OS1lYzk0NDhiMGNmMGM7Njg7YWU2ZjA1ZmMtMWRmMy00MDYyLWIzZGUtNzcxMDQ2YzJkYzlkIn0.Xp0LGv53exFxwnLNR2J2Do05WgMaL3zwZEv889_joLm_NhaPWr9PA9xpzOG_3mhGgoICNsdTU_DezBqPh6CXKQoN3vjpcfs4vTG6qvBIo2eZ1FWxrU15URqpwA_qcfiNCci_FPe8FNSa21GF-HMBgs1f-n6yJwsG2RmSbgnZk9vUWTRPMF1sWNLv4JG6XHUZEO6jwEVy2G2C-Jr8iT0g0jO9JY8kEQqwwbBcSDcIsiAU6UuOpLYVWCLr8ZB3k_UzcvlovC-_1MmQ6VHTReGdswleFjxNSu-OlL1IhB-RqheEnoQLZ8RD8nAmnZRyf9OaCa_JiE-j0thx5EVCBH5aHg\u0022,\u0022postParameters\u0022:null,\u0022postUrl\u0022:null}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00000.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00000.response.json new file mode 100644 index 0000000000..c0dd10005f --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-30a0-4000-4c6b-a5401d8be5ba","SPClientServiceRequestDuration":"11","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:\u0022ceb5fd80-a434-4a62-a60b-b272f10ba1df\u0022,\u0022Url\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00001.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00001.response.json new file mode 100644 index 0000000000..d492ebd43f --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-10a4-4000-4767-defb790aa6d7","SPClientServiceRequestDuration":"12","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u00220ad55b5d-6a79-467b-ad21-d4bef7948a79\u0022,\u0022Id\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00002.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00002.response.json new file mode 100644 index 0000000000..22636f87c2 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-40a8-4000-4c6b-ad89c8f9e3f1","SPClientServiceRequestDuration":"15","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{7E28289F-63EE-4881-9B96-2BE3928BE3D3},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{7E28289F-63EE-4881-9B96-2BE3928BE3D3},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002218335\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared%20Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx?d=w7e28289f63ee48819b962be3928be3d3\u0022,\u0022LinkingUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx?d=w7e28289f63ee48819b962be3928be3d3\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_GetFilePreviewAsyncTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewAsyncTest.docx\u0022,\u0022TimeCreated\u0022:\u00222022-06-19T15:02:27Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:02:27Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u00227e28289f-63ee-4881-9b96-2be3928be3d3\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00003.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00003.response.json new file mode 100644 index 0000000000..5cb30294d7 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewAsyncTest-2-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-b0ac-4000-7f3c-29621bcab9e7","SPClientServiceRequestDuration":"66","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":""} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00000.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00000.response.json new file mode 100644 index 0000000000..91917c50c1 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-a0b6-4000-4c6b-a010e10ac70e","SPClientServiceRequestDuration":"12","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:\u0022ceb5fd80-a434-4a62-a60b-b272f10ba1df\u0022,\u0022Url\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00001.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00001.response.json new file mode 100644 index 0000000000..4ecf905f06 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-90ba-4000-4767-dab9c4d921a5","SPClientServiceRequestDuration":"11","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u00220ad55b5d-6a79-467b-ad21-d4bef7948a79\u0022,\u0022Id\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00002.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00002.response.json new file mode 100644 index 0000000000..caaa435c36 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-b0be-4000-4c6b-a81e73eea365","SPClientServiceRequestDuration":"36","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022value\u0022:[{\u0022AllowContentTypes\u0022:true,\u0022BaseTemplate\u0022:101,\u0022BaseType\u0022:1,\u0022ContentTypesEnabled\u0022:false,\u0022CrawlNonDefaultViews\u0022:false,\u0022Created\u0022:\u00222022-03-06T01:58:24Z\u0022,\u0022CurrentChangeToken\u0022:{\u0022StringValue\u0022:\u00221;3;68e9c7c6-94e1-4422-9eef-ca5a274ee7c6;637912477478470000;503776427\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/pnpcoresdktestgroup/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:\u002268e9c7c6-94e1-4422-9eef-ca5a274ee7c6\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,\u0022IrmEnabled\u0022:false,\u0022IrmExpire\u0022:false,\u0022IrmReject\u0022:false,\u0022IsApplicationList\u0022:false,\u0022IsCatalog\u0022:false,\u0022IsPrivate\u0022:false,\u0022ItemCount\u0022:7,\u0022LastItemDeletedDate\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022LastItemModifiedDate\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022LastItemUserModifiedDate\u0022:\u00222022-06-19T15:02:28Z\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/pnpcoresdktestgroup\u0022},\u0022ParentWebUrl\u0022:\u0022/sites/pnpcoresdktestgroup\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/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00003.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00003.response.json new file mode 100644 index 0000000000..a3cab6ba7f --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-20c5-4000-7f3c-2ade96117720","SPClientServiceRequestDuration":"19","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022Exists\u0022:true,\u0022IsWOPIEnabled\u0022:false,\u0022ItemCount\u0022:7,\u0022Name\u0022:\u0022Shared Documents\u0022,\u0022ProgID\u0022:null,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents\u0022,\u0022TimeCreated\u0022:\u00222022-03-06T01:58:24Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022UniqueId\u0022:\u00222a0ba280-7c53-4eb9-a460-2c31576f90a8\u0022,\u0022WelcomePage\u0022:\u0022\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00004.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00004.response.json new file mode 100644 index 0000000000..0f3ddd74f6 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-0-00004.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-30ca-4000-4c6b-a2e34439a6e5","SPClientServiceRequestDuration":"182","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{C548AEC8-0A09-4B89-A364-9F4653F1C858},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{C548AEC8-0A09-4B89-A364-9F4653F1C858},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002218335\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared%20Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx?d=wc548aec80a094b89a3649f4653f1c858\u0022,\u0022LinkingUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx?d=wc548aec80a094b89a3649f4653f1c858\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx\u0022,\u0022TimeCreated\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u0022c548aec8-0a09-4b89-a364-9f4653f1c858\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00000.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00000.response.json new file mode 100644 index 0000000000..7bc2e39e7b --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-d0d9-4000-4767-d491dd39bd53","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:\u0022ceb5fd80-a434-4a62-a60b-b272f10ba1df\u0022,\u0022Url\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00001.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00001.response.json new file mode 100644 index 0000000000..7621b0d246 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-f0dd-4000-4c6b-a9e977bb3c69","SPClientServiceRequestDuration":"11","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u00220ad55b5d-6a79-467b-ad21-d4bef7948a79\u0022,\u0022Id\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00002.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00002.response.json new file mode 100644 index 0000000000..54bedc2350 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-70e2-4000-7f3c-2f4b5d796696","SPClientServiceRequestDuration":"15","X-SharePointHealthScore":"2","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{C548AEC8-0A09-4B89-A364-9F4653F1C858},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{C548AEC8-0A09-4B89-A364-9F4653F1C858},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002218335\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared%20Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx?d=wc548aec80a094b89a3649f4653f1c858\u0022,\u0022LinkingUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx?d=wc548aec80a094b89a3649f4653f1c858\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx\u0022,\u0022TimeCreated\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u0022c548aec8-0a09-4b89-a364-9f4653f1c858\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00003.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00003.response.json new file mode 100644 index 0000000000..9f4e113404 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-70e7-4000-4c6b-af17d619484a","SPClientServiceRequestDuration":"40","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022SiteId\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022,\u0022UniqueId\u0022:\u0022c548aec8-0a09-4b89-a364-9f4653f1c858\u0022,\u0022VroomDriveID\u0022:\u0022b!T4-bD44OMEa7ClAUQtubZID9tc40pGJKpguycvELod_Gx-lo4ZQiRJ7vylonTufG\u0022,\u0022VroomItemID\u0022:\u0022013TMHP6WIVZEMKCIKRFF2GZE7IZJ7DSCY\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00004.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00004.response.json new file mode 100644 index 0000000000..85cf3dd029 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-1-00004.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"Cache-Control":"no-store, no-cache","Transfer-Encoding":"chunked","Location":"https://graph.microsoft.com/","Vary":"Accept-Encoding","Strict-Transport-Security":"max-age=31536000","request-id":"51317409-18b6-4c1f-89fe-3ad00bd0b425","client-request-id":"51317409-18b6-4c1f-89fe-3ad00bd0b425","x-ms-ags-diagnostic":"{\u0022ServerInfo\u0022:{\u0022DataCenter\u0022:\u0022North Europe\u0022,\u0022Slice\u0022:\u0022E\u0022,\u0022Ring\u0022:\u00224\u0022,\u0022ScaleUnit\u0022:\u0022003\u0022,\u0022RoleInstance\u0022:\u0022DB1PEPF0001F9C5\u0022}}","OData-Version":"4.0","Date":"Sun, 19 Jun 2022 15:02:28 GMT"},"Response":"{\u0022@odata.context\u0022:\u0022https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.itemPreviewInfo\u0022,\u0022getUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/_layouts/15/embed.aspx?uniqueId=c548aec8-0a09-4b89-a364-9f4653f1c858\u0026embed=%7b%22p%22%3a2%2c%22z%22%3a5%7d\u0026access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvbWF0aGlqc2RldjIuc2hhcmVwb2ludC5jb21AZTFkZDQwMjMtYTY1Ni00ODBhLThhMGUtYzFiMWVlYzUxZTFkIiwiaXNzIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwIiwibmJmIjoiMTY1NTY1MDk0OCIsImV4cCI6IjE2NTU2NTEyNDgiLCJlbmRwb2ludHVybCI6ImtsUWdrK2tNcStnMWp3ckUwbDl3V3M0TTJoWEh6RGxZMW81dFRvQStHanM9IiwiZW5kcG9pbnR1cmxMZW5ndGgiOiIxMjkiLCJpc2xvb3BiYWNrIjoiVHJ1ZSIsImNpZCI6Ik5URXpNVGMwTURrdE1UaGlOaTAwWXpGbUxUZzVabVV0TTJGa01EQmlaREJpTkRJMSIsInZlciI6Imhhc2hlZHByb29mdG9rZW4iLCJzaXRlaWQiOiJNR1k1WWpobU5HWXRNR1U0WlMwME5qTXdMV0ppTUdFdE5UQXhORFF5WkdJNVlqWTAiLCJhcHBfZGlzcGxheW5hbWUiOiJQblBDb3JlRGV2IiwiZ2l2ZW5fbmFtZSI6Ik1hdGhpanMiLCJmYW1pbHlfbmFtZSI6IlZlcmJlZWNrIiwiYXBwaWQiOiJhMmJmNzIzZC1hNzUyLTQ4MGQtOTE1OS1lYzk0NDhiMGNmMGMiLCJ0aWQiOiJlMWRkNDAyMy1hNjU2LTQ4MGEtOGEwZS1jMWIxZWVjNTFlMWQiLCJ1cG4iOiJtYXRoaWpzQG1hdGhpanNkZXYyLm9ubWljcm9zb2Z0LmNvbSIsInB1aWQiOiIxMDAzMjAwMDlEODI2N0ZDIiwiY2FjaGVrZXkiOiIwaC5mfG1lbWJlcnNoaXB8MTAwMzIwMDA5ZDgyNjdmY0BsaXZlLmNvbSIsInNjcCI6ImFsbHNpdGVzLmZ1bGxjb250cm9sIGdyb3VwLndyaXRlIGFsbHByb2ZpbGVzLnJlYWQgYWxscHJvZmlsZXMud3JpdGUgdGVybXN0b3JlLndyaXRlIiwidHQiOiIyIiwidXNlUGVyc2lzdGVudENvb2tpZSI6bnVsbCwiaXBhZGRyIjoiNDAuMTI2LjMxLjk5In0.aWVLTTF3eDVKdU92d09tZ0YvT0MzNUQ3Qm1JTFFMMWc3ZzdPUmI3eUJIbz0#wopiToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImFrUFRFTzRYU0N4c3hXOTBHMl9Zd1lWRGdIYyJ9.eyJhdWQiOiJ3b3BpL21hdGhpanNkZXYyLnNoYXJlcG9pbnQuY29tQGUxZGQ0MDIzLWE2NTYtNDgwYS04YTBlLWMxYjFlZWM1MWUxZCIsImlzcyI6IjAwMDAwMDAzLTAwMDAtMGZmMS1jZTAwLTAwMDAwMDAwMDAwMEA5MDE0MDEyMi04NTE2LTExZTEtOGVmZi00OTMwNDkyNDAxOWIiLCJuYmYiOiIxNjU1NjUwOTQ4IiwiZXhwIjoiMTY1NTY1MTI0OCIsIm5hbWVpZCI6IjEwMDMyMDAwOWQ4MjY3ZmMiLCJuaWkiOiJ1cm46ZmVkZXJhdGlvbjptaWNyb3NvZnRvbmxpbmUiLCJjYWNoZWtleSI6IjBoLmZ8bWVtYmVyc2hpcHwxMDAzMjAwMDlkODI2N2ZjQGxpdmUuY29tIiwiaXN1c2VyIjoidHJ1ZSIsImlwYWRkciI6IjgxLjI0Ny4yMzUuMTY5IiwidXRpIjoiVk9seXdNMUJGRXV3bmhIVHpnQTdBQSIsImFwcGlkIjoiYTJiZjcyM2QtYTc1Mi00ODBkLTkxNTktZWM5NDQ4YjBjZjBjIiwidGlkIjoiZTFkZDQwMjMtYTY1Ni00ODBhLThhMGUtYzFiMWVlYzUxZTFkIiwid29waV9hcCI6ImFsbHNpdGVzLmZ1bGxjb250cm9sIGdyb3VwLndyaXRlIGFsbHByb2ZpbGVzLnJlYWQgYWxscHJvZmlsZXMud3JpdGUgdGVybXN0b3JlLndyaXRlIiwid29waV90dCI6IlByZUF1dGhUb2tlbiIsImFwcGN0eCI6ImM1NDhhZWM4MGEwOTRiODlhMzY0OWY0NjUzZjFjODU4O01NSW9kVHVrMnhacDRTTFIyUlQ3cU9HcTNsTT07RGVmYXVsdDs7N0ZGRkZGRkZGRkZCRkZGRjtUcnVlOzthMmJmNzIzZC1hNzUyLTQ4MGQtOTE1OS1lYzk0NDhiMGNmMGM7Njg7NTEzMTc0MDktMThiNi00YzFmLTg5ZmUtM2FkMDBiZDBiNDI1In0.sjQk6kGws9kyKhY1Q7mIuMpDOQwTBudpTk3sGzM3jncfIhtAsdSHlJTN93UNPcCWkQLbqwM_7sKMPbAklGFXnk5wq75JXKXbhCDgtk_Oqm5n2ucWaoTrhMqWmEz2Ou4WLU0Q0_pmtl-t9vkgTzFu5B-0W2VRqhuH70adD_IX_Nlwsst60a0wc109rntT_hmtOBCKl9mOpWWtObI5TJIvU-41v4h1JHCVRLzFCabPKWKhrmikps2rccLkg-gDALYgU_LbQqjrj9OojRBmo-F7t_2A5zKqnH2tQIxH537yQP74IQeAPEVdmBQVCUYYfqapYuFe6awrKUmsj9FusIEjbA\u0022,\u0022postParameters\u0022:null,\u0022postUrl\u0022:null}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00000.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00000.response.json new file mode 100644 index 0000000000..2244d82208 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00000.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-20f7-4000-4767-d7332d681ab2","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:\u0022ceb5fd80-a434-4a62-a60b-b272f10ba1df\u0022,\u0022Url\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00001.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00001.response.json new file mode 100644 index 0000000000..b103cf2d4a --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00001.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"96ea48a0-30fc-4000-4c6b-a4140439f021","SPClientServiceRequestDuration":"12","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u00220ad55b5d-6a79-467b-ad21-d4bef7948a79\u0022,\u0022Id\u0022:\u00220f9b8f4f-0e8e-4630-bb0a-501442db9b64\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00002.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00002.response.json new file mode 100644 index 0000000000..692cc9ea3e --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00002.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"97ea48a0-b000-4000-7f3c-2ed265d517fb","SPClientServiceRequestDuration":"15","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022CheckInComment\u0022:\u0022\u0022,\u0022CheckOutType\u0022:2,\u0022ContentTag\u0022:\u0022{C548AEC8-0A09-4B89-A364-9F4653F1C858},1,2\u0022,\u0022CustomizedPageStatus\u0022:0,\u0022ETag\u0022:\u0022\\\u0022{C548AEC8-0A09-4B89-A364-9F4653F1C858},1\\\u0022\u0022,\u0022Exists\u0022:true,\u0022IrmEnabled\u0022:false,\u0022Length\u0022:\u002218335\u0022,\u0022Level\u0022:1,\u0022LinkingUri\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared%20Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx?d=wc548aec80a094b89a3649f4653f1c858\u0022,\u0022LinkingUrl\u0022:\u0022https://mathijsdev2.sharepoint.com/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx?d=wc548aec80a094b89a3649f4653f1c858\u0022,\u0022MajorVersion\u0022:1,\u0022MinorVersion\u0022:0,\u0022Name\u0022:\u0022PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx\u0022,\u0022ServerRelativeUrl\u0022:\u0022/sites/pnpcoresdktestgroup/Shared Documents/PNP_SDK_TEST_GetFilePreviewIncludingPageAndZoomAsyncTest.docx\u0022,\u0022TimeCreated\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022TimeLastModified\u0022:\u00222022-06-19T15:02:28Z\u0022,\u0022Title\u0022:\u0022\u0022,\u0022UIVersion\u0022:512,\u0022UIVersionLabel\u0022:\u00221.0\u0022,\u0022UniqueId\u0022:\u0022c548aec8-0a09-4b89-a364-9f4653f1c858\u0022}"} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00003.response.json b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00003.response.json new file mode 100644 index 0000000000..5b1ffad103 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/FilesTests/GetFilePreviewIncludingPageAndZoomAsyncTest-2-00003.response.json @@ -0,0 +1 @@ +{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"97ea48a0-c004-4000-4c6b-ac6b2340c624","SPClientServiceRequestDuration":"63","X-SharePointHealthScore":"0","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":""} \ No newline at end of file diff --git a/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/File.cs b/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/File.cs index 002a8ca1f8..bbe494d372 100644 --- a/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/File.cs +++ b/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/File.cs @@ -1005,6 +1005,67 @@ public List GetAnalytics(AnalyticsOptions options = null) } #endregion + #region Preview + + public async Task GetPreviewAsync(string page = "", int zoom = 0) + { + await EnsurePropertiesAsync(y => y.SiteId, y => y.VroomItemID, y => y.VroomDriveID).ConfigureAwait(false); + + dynamic body = new ExpandoObject(); + + if (page != string.Empty) + { + body.page = page; + } + + if (zoom != 0) + { + body.zoom = zoom; + } + + var apiCall = new ApiCall($"sites/{SiteId}/drives/{VroomDriveID}/items/{VroomItemID}/preview", ApiType.Graph, jsonBody: JsonSerializer.Serialize(body, typeof(ExpandoObject), PnPConstants.JsonSerializer_IgnoreNullValues_CamelCase)); + + var response = await RawRequestAsync(apiCall, HttpMethod.Post).ConfigureAwait(false); + + if (response.StatusCode != HttpStatusCode.OK) + { + throw new MicrosoftGraphServiceException(PnPCoreResources.Exception_RetrievingPreview_Failed); + } + + return GetPreviewFromResponse(response.Json); + } + + public IFilePreview GetPreview(string page = "", int zoom = 0) + { + return GetPreviewAsync(page, zoom).GetAwaiter().GetResult(); + } + + private static IFilePreview GetPreviewFromResponse(string json) + { + var jsonElement = JsonSerializer.Deserialize(json); + + var filePreview = new FilePreview(); + + if (jsonElement.TryGetProperty("getUrl", out JsonElement getUrl)) + { + filePreview.GetUrl = getUrl.GetString(); + } + + if (jsonElement.TryGetProperty("postUrl", out JsonElement postUrl)) + { + filePreview.PostUrl = postUrl.GetString(); + } + + if (jsonElement.TryGetProperty("postParameters", out JsonElement postParameters)) + { + filePreview.PostParameters = postParameters.GetString(); + } + + return filePreview; + } + + #endregion + #endregion #region Helper methods diff --git a/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/FilePreview.cs b/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/FilePreview.cs new file mode 100644 index 0000000000..5a34763bcc --- /dev/null +++ b/src/sdk/PnP.Core/Model/SharePoint/Core/Internal/FilePreview.cs @@ -0,0 +1,13 @@ +using System; + +namespace PnP.Core.Model.SharePoint +{ + internal class FilePreview : IFilePreview + { + public string GetUrl { get; set; } + + public string PostUrl { get; set; } + + public string PostParameters { get; set; } + } +} diff --git a/src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFile.cs b/src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFile.cs index 826e55e478..61b7c333a9 100644 --- a/src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFile.cs +++ b/src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFile.cs @@ -809,5 +809,27 @@ public interface IFile : IDataModel, IDataModelGet, IDataModelLoad public List GetAnalytics(AnalyticsOptions options = null); #endregion + + #region Preview + + /// + /// This action allows you to obtain short-lived embeddable URLs for an item in order to render a temporary preview. + /// The 'page' and 'zoom' options may not be available for all preview apps, but will be applied if the preview app supports it. + /// + /// Optional. Page number of document to start at, if applicable. Specified as string for future use cases around file types such as ZIP. + /// Optional. Zoom level to start at, if applicable. + /// FilePreview object. Either getUrl, postUrl, or both might be returned depending on the current state of embed support for the specified options. + Task GetPreviewAsync(string page = "", int zoom = 0); + + /// + /// This action allows you to obtain short-lived embeddable URLs for an item in order to render a temporary preview. + /// The 'page' and 'zoom' options may not be available for all preview apps, but will be applied if the preview app supports it. + /// + /// Optional. Page number of document to start at, if applicable. Specified as string for future use cases around file types such as ZIP. + /// Optional. Zoom level to start at, if applicable. + /// FilePreview object. Either getUrl, postUrl, or both might be returned depending on the current state of embed support for the specified options. + IFilePreview GetPreview(string page = "", int zoom = 0); + + #endregion } } diff --git a/src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFilePreview.cs b/src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFilePreview.cs new file mode 100644 index 0000000000..5985d48209 --- /dev/null +++ b/src/sdk/PnP.Core/Model/SharePoint/Core/Public/IFilePreview.cs @@ -0,0 +1,28 @@ +namespace PnP.Core.Model.SharePoint +{ + /// + /// Response object from a Graph Preview call on an IFile object + /// Either getUrl, postUrl, or both might be returned depending on the current state of embed support for the specified options. + /// postParameters is a string formatted as application/x-www-form-urlencoded, and if performing a POST to the postUrl the content-type should be set accordingly. For example: + /// POST https://www.onedrive.com/embed_by_post + /// Content-Type: application/x-www-form-urlencoded + /// param1=value&param2=another%20value + /// + public interface IFilePreview + { + /// + /// URL suitable for embedding using HTTP GET (iframes, etc.) + /// + string GetUrl { get; } + + /// + /// URL suitable for embedding using HTTP POST (form post, JS, etc.) + /// + string PostUrl { get; } + + /// + /// POST parameters to include if using postUrl + /// + string PostParameters { get; } + } +} diff --git a/src/sdk/PnP.Core/PnPCoreResources.Designer.cs b/src/sdk/PnP.Core/PnPCoreResources.Designer.cs index 6fb6d885dc..9466b40788 100644 --- a/src/sdk/PnP.Core/PnPCoreResources.Designer.cs +++ b/src/sdk/PnP.Core/PnPCoreResources.Designer.cs @@ -600,6 +600,15 @@ internal static string Exception_RetrievingContentTypeHubSiteId { } } + /// + /// Looks up a localized string similar to Error occured on retrieving preview from File. + /// + internal static string Exception_RetrievingPreview_Failed { + get { + return ResourceManager.GetString("Exception_RetrievingPreview_Failed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Role definition '{0}' not found.. /// diff --git a/src/sdk/PnP.Core/PnPCoreResources.resx b/src/sdk/PnP.Core/PnPCoreResources.resx index 3bcd611e52..3d64ff518e 100644 --- a/src/sdk/PnP.Core/PnPCoreResources.resx +++ b/src/sdk/PnP.Core/PnPCoreResources.resx @@ -471,4 +471,7 @@ Max retries of {0} reached while waiting for operation {1} + + Error occured on retrieving preview from File + \ No newline at end of file