diff --git a/src/sdk/PnP.Core.Test/SharePoint/ListViewTests.cs b/src/sdk/PnP.Core.Test/SharePoint/ListViewTests.cs index 6654b7baf0..aafd86df52 100644 --- a/src/sdk/PnP.Core.Test/SharePoint/ListViewTests.cs +++ b/src/sdk/PnP.Core.Test/SharePoint/ListViewTests.cs @@ -2,6 +2,7 @@ using PnP.Core.Model.SharePoint; using PnP.Core.QueryModel; using PnP.Core.Test.Utilities; +using System; using System.Linq; using System.Threading.Tasks; @@ -267,5 +268,21 @@ public async Task AddListViewType2CompactList() } } + [TestMethod] + public async Task GetViewByNewGuidTest() + { + //TestCommon.Instance.Mocking = false; + + using (var context = await TestCommon.Instance.GetContextAsync(TestCommon.TestSite)) + { + var list = context.Web.Lists.GetByServerRelativeUrl($"{context.Uri.LocalPath}/Shared Documents", p => p.Views); + var requestedView = list.Views.AsRequested().First(); + + var idString = requestedView.Id.ToString(); + var view = list.Views.FirstOrDefault(v => v.Id == new Guid(idString)); + + Assert.IsTrue(view != null); + } + } } } diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00000.response b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00000.response new file mode 100644 index 0000000000..1670e5d7c9 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00000.response @@ -0,0 +1 @@ +{"d":{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web","type":"SP.Web"},"RegionalSettings":{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/RegionalSettings","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/RegionalSettings","type":"SP.RegionalSettings"},"InstalledLanguages":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/RegionalSettings/InstalledLanguages"}},"TimeZone":{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/RegionalSettings/TimeZone","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/RegionalSettings/TimeZone","type":"SP.TimeZone"},"Description":"(UTC-08:00) Pacific Time (US and Canada)","Id":13,"Information":{"__metadata":{"type":"SP.TimeZoneInformation"},"Bias":480,"DaylightBias":-60,"StandardBias":0}},"TimeZones":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/RegionalSettings/TimeZones"}},"AdjustHijriDays":0,"AlternateCalendarType":0,"AM":"AM","CalendarType":1,"Collation":25,"CollationLCID":2070,"DateFormat":0,"DateSeparator":"/","DecimalSeparator":".","DigitGrouping":"3;0","FirstDayOfWeek":0,"FirstWeekOfYear":0,"IsEastAsia":false,"IsRightToLeft":false,"IsUIRightToLeft":false,"ListSeparator":",","LocaleId":1033,"NegativeSign":"-","NegNumberMode":1,"PM":"PM","PositiveSign":"","ShowWeeks":false,"ThousandSeparator":",","Time24":false,"TimeMarkerPosition":0,"TimeSeparator":":","WorkDayEndHour":1020,"WorkDays":62,"WorkDayStartHour":480},"Id":"3f5d7b8e-b72a-4881-b7bc-2de2a15200bc","Url":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup"}} \ No newline at end of file diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00001.response b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00001.response new file mode 100644 index 0000000000..6fc1549bad --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00001.response @@ -0,0 +1,9 @@ +--batchresponse_55bb5180-cfa7-4fa4-acf3-32393334305e +Content-Type: application/http +Content-Transfer-Encoding: binary + +HTTP/1.1 200 OK +CONTENT-TYPE: application/json;odata=verbose;charset=utf-8 + +{"d":{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Site","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Site","type":"SP.Site"},"GroupId":"35655e29-b619-4c63-bd0c-750b71d40841","Id":"286393c5-fb92-4650-a1a6-1685d73cfd81"}} +--batchresponse_55bb5180-cfa7-4fa4-acf3-32393334305e-- diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00002.response b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00002.response new file mode 100644 index 0000000000..7c5514cf22 --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00002.response @@ -0,0 +1,10 @@ +--batchresponse_9c3e60f7-159e-4b5b-a756-596ab525fd44 +Content-Type: application/http +Content-Transfer-Encoding: binary + +HTTP/1.1 200 OK +CONTENT-TYPE: application/json;odata=verbose;charset=utf-8 +ETAG: "13" + +{"d":{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')","etag":"\"13\"","type":"SP.List"},"Views":{"results":[{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'925fc271-1090-403d-98f8-99800008762a')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'925fc271-1090-403d-98f8-99800008762a')","type":"SP.View"},"ViewFields":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'925fc271-1090-403d-98f8-99800008762a')/ViewFields"}},"Aggregations":null,"AggregationsStatus":null,"AssociatedContentTypeId":null,"BaseViewId":"9","CalendarViewStyles":null,"ColumnWidth":null,"ContentTypeId":{"__metadata":{"type":"SP.ContentTypeId"},"StringValue":"0x"},"CustomFormatter":null,"CustomOrder":null,"DefaultView":false,"DefaultViewForContentType":false,"EditorModified":false,"Formats":null,"GridLayout":null,"Hidden":true,"HtmlSchemaXml":"","Id":"925fc271-1090-403d-98f8-99800008762a","ImageUrl":"/_layouts/15/images/dlicon.png?rev=47","IncludeRootFolder":false,"ViewJoins":null,"JSLink":null,"ListViewXml":"","Method":null,"MobileDefaultView":false,"MobileView":false,"ModerationType":null,"NewDocumentTemplates":null,"OrderedView":false,"Paged":true,"PersonalView":false,"ViewProjectedFields":null,"ViewQuery":"1","ReadOnlyView":false,"RequiresClientIntegration":false,"RowLimit":30,"Scope":0,"ServerRelativePath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/repair.aspx"},"ServerRelativeUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/repair.aspx","StyleId":null,"TabularView":false,"Threaded":false,"Title":"Relink Documents","Toolbar":"","ToolbarTemplateName":"RelinkToolBar","ViewType":"HTML","ViewData":null,"ViewType2":null,"VisualizationInfo":null},{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'36a145b4-72aa-4f6a-bddf-3e62b3a604b6')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'36a145b4-72aa-4f6a-bddf-3e62b3a604b6')","type":"SP.View"},"ViewFields":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'36a145b4-72aa-4f6a-bddf-3e62b3a604b6')/ViewFields"}},"Aggregations":null,"AggregationsStatus":null,"AssociatedContentTypeId":null,"BaseViewId":"40","CalendarViewStyles":null,"ColumnWidth":null,"ContentTypeId":{"__metadata":{"type":"SP.ContentTypeId"},"StringValue":"0x"},"CustomFormatter":null,"CustomOrder":null,"DefaultView":false,"DefaultViewForContentType":false,"EditorModified":false,"Formats":null,"GridLayout":null,"Hidden":true,"HtmlSchemaXml":"","Id":"36a145b4-72aa-4f6a-bddf-3e62b3a604b6","ImageUrl":"/_layouts/15/images/dlicon.png?rev=47","IncludeRootFolder":false,"ViewJoins":null,"JSLink":null,"ListViewXml":"","Method":null,"MobileDefaultView":false,"MobileView":false,"ModerationType":null,"NewDocumentTemplates":null,"OrderedView":false,"Paged":false,"PersonalView":false,"ViewProjectedFields":null,"ViewQuery":"","ReadOnlyView":false,"RequiresClientIntegration":false,"RowLimit":20,"Scope":0,"ServerRelativePath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Thumbnails.aspx"},"ServerRelativeUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Thumbnails.aspx","StyleId":null,"TabularView":true,"Threaded":false,"Title":"assetLibTemp","Toolbar":null,"ToolbarTemplateName":null,"ViewType":"HTML","ViewData":null,"ViewType2":null,"VisualizationInfo":null},{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'ff83e292-cd39-40ab-8d0f-1123bdc9e1dd')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'ff83e292-cd39-40ab-8d0f-1123bdc9e1dd')","type":"SP.View"},"ViewFields":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'ff83e292-cd39-40ab-8d0f-1123bdc9e1dd')/ViewFields"}},"Aggregations":null,"AggregationsStatus":null,"AssociatedContentTypeId":null,"BaseViewId":"7","CalendarViewStyles":null,"ColumnWidth":null,"ContentTypeId":{"__metadata":{"type":"SP.ContentTypeId"},"StringValue":"0x"},"CustomFormatter":null,"CustomOrder":null,"DefaultView":false,"DefaultViewForContentType":false,"EditorModified":false,"Formats":null,"GridLayout":null,"Hidden":true,"HtmlSchemaXml":"","Id":"ff83e292-cd39-40ab-8d0f-1123bdc9e1dd","ImageUrl":"/_layouts/15/images/dlicon.png?rev=47","IncludeRootFolder":false,"ViewJoins":null,"JSLink":"clienttemplates.js","ListViewXml":"","Method":null,"MobileDefaultView":false,"MobileView":false,"ModerationType":null,"NewDocumentTemplates":null,"OrderedView":false,"Paged":true,"PersonalView":false,"ViewProjectedFields":null,"ViewQuery":"","ReadOnlyView":false,"RequiresClientIntegration":false,"RowLimit":30,"Scope":0,"ServerRelativePath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Combine.aspx"},"ServerRelativeUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Combine.aspx","StyleId":null,"TabularView":false,"Threaded":false,"Title":"Merge Documents","Toolbar":"","ToolbarTemplateName":"MergeToolBar","ViewType":"HTML","ViewData":null,"ViewType2":null,"VisualizationInfo":null},{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'fd9b0d40-6d6c-43f0-9ac1-32ebfb4dffbf')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'fd9b0d40-6d6c-43f0-9ac1-32ebfb4dffbf')","type":"SP.View"},"ViewFields":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'fd9b0d40-6d6c-43f0-9ac1-32ebfb4dffbf')/ViewFields"}},"Aggregations":null,"AggregationsStatus":null,"AssociatedContentTypeId":null,"BaseViewId":"1","CalendarViewStyles":null,"ColumnWidth":null,"ContentTypeId":{"__metadata":{"type":"SP.ContentTypeId"},"StringValue":"0x"},"CustomFormatter":null,"CustomOrder":null,"DefaultView":true,"DefaultViewForContentType":false,"EditorModified":false,"Formats":null,"GridLayout":null,"Hidden":false,"HtmlSchemaXml":"main.xslclienttemplates.js30","Id":"fd9b0d40-6d6c-43f0-9ac1-32ebfb4dffbf","ImageUrl":"/_layouts/15/images/dlicon.png?rev=47","IncludeRootFolder":false,"ViewJoins":null,"JSLink":"clienttemplates.js","ListViewXml":"30clienttemplates.jsmain.xsl","Method":null,"MobileDefaultView":true,"MobileView":true,"ModerationType":null,"NewDocumentTemplates":null,"OrderedView":false,"Paged":true,"PersonalView":false,"ViewProjectedFields":null,"ViewQuery":"","ReadOnlyView":false,"RequiresClientIntegration":false,"RowLimit":30,"Scope":0,"ServerRelativePath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/AllItems.aspx"},"ServerRelativeUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/AllItems.aspx","StyleId":null,"TabularView":true,"Threaded":false,"Title":"All Documents","Toolbar":"","ToolbarTemplateName":null,"ViewType":"HTML","ViewData":null,"ViewType2":null,"VisualizationInfo":null},{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'83e07c9a-27ab-44ab-a290-1444672e5f01')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'83e07c9a-27ab-44ab-a290-1444672e5f01')","type":"SP.View"},"ViewFields":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'83e07c9a-27ab-44ab-a290-1444672e5f01')/ViewFields"}},"Aggregations":null,"AggregationsStatus":null,"AssociatedContentTypeId":null,"BaseViewId":"1","CalendarViewStyles":null,"ColumnWidth":null,"ContentTypeId":{"__metadata":{"type":"SP.ContentTypeId"},"StringValue":"0x"},"CustomFormatter":null,"CustomOrder":null,"DefaultView":false,"DefaultViewForContentType":false,"EditorModified":false,"Formats":null,"GridLayout":null,"Hidden":false,"HtmlSchemaXml":"NONE30main.xslclienttemplates.js","Id":"83e07c9a-27ab-44ab-a290-1444672e5f01","ImageUrl":"/_layouts/15/images/dlicon.png?rev=47","IncludeRootFolder":false,"ViewJoins":null,"JSLink":"clienttemplates.js","ListViewXml":"30clienttemplates.jsmain.xslNONE","Method":null,"MobileDefaultView":false,"MobileView":false,"ModerationType":null,"NewDocumentTemplates":null,"OrderedView":false,"Paged":false,"PersonalView":false,"ViewProjectedFields":null,"ViewQuery":"","ReadOnlyView":false,"RequiresClientIntegration":false,"RowLimit":30,"Scope":0,"ServerRelativePath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Test1.aspx"},"ServerRelativeUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Test1.aspx","StyleId":null,"TabularView":true,"Threaded":false,"Title":"Test12","Toolbar":"","ToolbarTemplateName":null,"ViewType":"HTML","ViewData":null,"ViewType2":"NONE","VisualizationInfo":null},{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'db29f658-cf8b-4d14-981a-bc1966352edd')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'db29f658-cf8b-4d14-981a-bc1966352edd')","type":"SP.View"},"ViewFields":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'db29f658-cf8b-4d14-981a-bc1966352edd')/ViewFields"}},"Aggregations":null,"AggregationsStatus":null,"AssociatedContentTypeId":null,"BaseViewId":"1","CalendarViewStyles":null,"ColumnWidth":null,"ContentTypeId":{"__metadata":{"type":"SP.ContentTypeId"},"StringValue":"0x"},"CustomFormatter":null,"CustomOrder":null,"DefaultView":false,"DefaultViewForContentType":false,"EditorModified":false,"Formats":null,"GridLayout":null,"Hidden":false,"HtmlSchemaXml":"NONE30main.xslclienttemplates.js","Id":"db29f658-cf8b-4d14-981a-bc1966352edd","ImageUrl":"/_layouts/15/images/dlicon.png?rev=47","IncludeRootFolder":false,"ViewJoins":null,"JSLink":"clienttemplates.js","ListViewXml":"30clienttemplates.jsmain.xslNONE","Method":null,"MobileDefaultView":false,"MobileView":false,"ModerationType":null,"NewDocumentTemplates":null,"OrderedView":false,"Paged":false,"PersonalView":false,"ViewProjectedFields":null,"ViewQuery":"","ReadOnlyView":false,"RequiresClientIntegration":false,"RowLimit":30,"Scope":0,"ServerRelativePath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Test2.aspx"},"ServerRelativeUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/Test2.aspx","StyleId":null,"TabularView":true,"Threaded":false,"Title":"Test2","Toolbar":"","ToolbarTemplateName":null,"ViewType":"HTML","ViewData":null,"ViewType2":"NONE","VisualizationInfo":null}]},"Id":"84c3d851-b4f0-4c9f-a3b2-a0479a02e811"}} +--batchresponse_9c3e60f7-159e-4b5b-a756-596ab525fd44-- diff --git a/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00003.response b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00003.response new file mode 100644 index 0000000000..0886bd024e --- /dev/null +++ b/src/sdk/PnP.Core.Test/SharePoint/MockData/ListViewTests/GetViewByNewGuidTest-0-00003.response @@ -0,0 +1,9 @@ +--batchresponse_8872a170-3949-4e76-a4c0-10470652c01b +Content-Type: application/http +Content-Transfer-Encoding: binary + +HTTP/1.1 200 OK +CONTENT-TYPE: application/json;odata=verbose;charset=utf-8 + +{"d":{"results":[{"__metadata":{"id":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'925fc271-1090-403d-98f8-99800008762a')","uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'925fc271-1090-403d-98f8-99800008762a')","type":"SP.View"},"ViewFields":{"__deferred":{"uri":"https://m365x790252.sharepoint.com/sites/pnpcoresdktestgroup/_api/Web/Lists(guid'84c3d851-b4f0-4c9f-a3b2-a0479a02e811')/Views(guid'925fc271-1090-403d-98f8-99800008762a')/ViewFields"}},"Aggregations":null,"AggregationsStatus":null,"AssociatedContentTypeId":null,"BaseViewId":"9","CalendarViewStyles":null,"ColumnWidth":null,"ContentTypeId":{"__metadata":{"type":"SP.ContentTypeId"},"StringValue":"0x"},"CustomFormatter":null,"CustomOrder":null,"DefaultView":false,"DefaultViewForContentType":false,"EditorModified":false,"Formats":null,"GridLayout":null,"Hidden":true,"HtmlSchemaXml":"","Id":"925fc271-1090-403d-98f8-99800008762a","ImageUrl":"/_layouts/15/images/dlicon.png?rev=47","IncludeRootFolder":false,"ViewJoins":null,"JSLink":null,"ListViewXml":"","Method":null,"MobileDefaultView":false,"MobileView":false,"ModerationType":null,"NewDocumentTemplates":null,"OrderedView":false,"Paged":true,"PersonalView":false,"ViewProjectedFields":null,"ViewQuery":"1","ReadOnlyView":false,"RequiresClientIntegration":false,"RowLimit":30,"Scope":0,"ServerRelativePath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/repair.aspx"},"ServerRelativeUrl":"/sites/pnpcoresdktestgroup/Shared Documents/Forms/repair.aspx","StyleId":null,"TabularView":false,"Threaded":false,"Title":"Relink Documents","Toolbar":"","ToolbarTemplateName":"RelinkToolBar","ViewType":"HTML","ViewData":null,"ViewType2":null,"VisualizationInfo":null}]}} +--batchresponse_8872a170-3949-4e76-a4c0-10470652c01b-- diff --git a/src/sdk/PnP.Core/QueryModel/Query/ExpressionExtensions.cs b/src/sdk/PnP.Core/QueryModel/Query/ExpressionExtensions.cs index 16e31945f3..e4d6915102 100644 --- a/src/sdk/PnP.Core/QueryModel/Query/ExpressionExtensions.cs +++ b/src/sdk/PnP.Core/QueryModel/Query/ExpressionExtensions.cs @@ -15,6 +15,8 @@ internal static Expression>[] CastExpressions(this LambdaExpr internal static object GetConstantValue(this Expression expression) { expression = StripQuotes(expression); + var notSupportedException = new NotSupportedException(string.Format(PnPCoreResources.Exception_Unsupported_ExpressionConstantOnlyTypes, expression, typeof(ConstantExpression), typeof(MemberExpression))); + switch (expression) { case ConstantExpression ce: @@ -22,9 +24,16 @@ internal static object GetConstantValue(this Expression expression) case MemberExpression me: object obj = GetConstantValue(me.Expression); return me.Member.GetValue(obj); + case NewExpression ne: + if (ne.Type.Name == nameof(Guid)) + { + return Expression.Lambda>(expression).Compile().Invoke(); + } + + throw notSupportedException; } - throw new NotSupportedException(string.Format(PnPCoreResources.Exception_Unsupported_ExpressionConstantOnlyTypes, expression, typeof(ConstantExpression), typeof(MemberExpression))); + throw notSupportedException; } internal static Expression StripQuotes(this Expression e)