Skip to content

Commit

Permalink
Added BaseType property to IList #1532
Browse files Browse the repository at this point in the history
  • Loading branch information
bjansen committed Sep 16, 2024
1 parent 2416df7 commit 792cafa
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Changed

- Moved the approve permissions for deployed SPFx packages to use Graph instead of CSOM #1479 [mloitzl - Martin Loitzl]
- Added `BaseType` property to `IList` #1532 [jansenbe - Bert Jansen]

## [1.14]

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"09d76da0-30e9-5000-2251-13747a3f9a67","SPClientServiceRequestDuration":"11","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:\u00222c99a486-d6c9-4a4b-8d6f-a9faa364c92c\u0022,\u0022Url\u0022:\u0022https://bertonline.sharepoint.com/sites/prov-2\u0022}"}
{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"06e450a1-9086-9000-c10d-1beadf74035b","SPClientServiceRequestDuration":"421","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}"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"09d76da0-00ed-5000-5fe4-08a7f30790f6","SPClientServiceRequestDuration":"10","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}"}
{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"06e450a1-80b3-9000-c10d-169dfb8a6687","SPClientServiceRequestDuration":"11","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022GroupId\u0022:\u0022d40d729b-df60-4b57-ac8f-102595090e0a\u0022,\u0022Id\u0022:\u0022f92f9e40-1110-43ef-aa0e-0822e13fb7ba\u0022}"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"09d76da0-d0f0-5000-5faf-348ee561b0a5","SPClientServiceRequestDuration":"18","X-SharePointHealthScore":"3","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022BaseTemplate\u0022:101,\u0022Id\u0022:\u002213326e70-58ba-4e0e-9b30-08189f21d555\u0022,\u0022Title\u0022:\u0022Documents\u0022}"}
{"IsSuccessStatusCode":true,"StatusCode":200,"Headers":{"SPRequestGuid":"08e450a1-500b-9000-c10d-1c24136ddb8c","SPClientServiceRequestDuration":"17","X-SharePointHealthScore":"1","X-SP-SERVERSTATE":"ReadOnly=0"},"Response":"{\u0022BaseTemplate\u0022:101,\u0022BaseType\u0022:1,\u0022Id\u0022:\u002213326e70-58ba-4e0e-9b30-08189f21d555\u0022,\u0022Title\u0022:\u0022Documents\u0022}"}
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,23 @@ public async Task TestQueryGetByTitleWithFieldsLINQ_REST()
{
var expected = "Documents";

// TestCommon.Instance.Mocking = false;
//TestCommon.Instance.Mocking = false;
using (var context = await TestCommon.Instance.GetContextAsync(TestCommon.TestSite))
{
context.GraphFirst = false;

var actual = context.Web.Lists.GetByTitle(expected,
l => l.Id,
l => l.Title,
l => l.TemplateType
l => l.TemplateType,
l => l.BaseType
);

Assert.IsNotNull(actual);
Assert.AreEqual(expected, actual.Title);
Assert.AreNotEqual(Guid.Empty, actual.Id);
Assert.AreEqual(ListTemplateType.DocumentLibrary, actual.TemplateType);
Assert.AreEqual(ListBaseType.DocumentLibrary, actual.BaseType);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/sdk/PnP.Core/Model/SharePoint/Core/Internal/List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public List()
//[GraphProperty("list", JsonPath = "template")]
public ListTemplateType TemplateType { get => GetValue<ListTemplateType>(); set => SetValue(value); }

public ListBaseType BaseType { get => GetValue<ListBaseType>(); set => SetValue(value); }

public bool EnableVersioning { get => GetValue<bool>(); set => SetValue(value); }

public bool EnableMinorVersions { get => GetValue<bool>(); set => SetValue(value); }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace PnP.Core.Model.SharePoint
{
/// <summary>
/// Specifies the base type for a list.
/// </summary>
public enum ListBaseType : int
{
/// <summary>
/// No base type is specified.
/// </summary>
None = -1,

/// <summary>
/// Specifies a base type for lists that do not correspond to another base type in this enumeration.
/// </summary>
GenericList, // 0

/// <summary>
/// Specifies a base type for document libraries.
/// </summary>
DocumentLibrary, // 1

/// <summary>
/// Reserved. MUST not be used.
/// </summary>
Unused, // 2

/// <summary>
/// Deprecated - used for discussion board lists pre-WSS V3.
/// Newer discussion boards use the GenericList base type and ListTemplateType.DiscussionBoard.
/// </summary>
DiscussionBoard, // 3

/// <summary>
/// Specifies a base type for survey lists.
/// </summary>
Survey, // 4

/// <summary>
/// Specifies a base type for issue tracking lists.
/// </summary>
Issue, // 5
}
}
5 changes: 5 additions & 0 deletions src/sdk/PnP.Core/Model/SharePoint/Core/Public/IList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public interface IList : IDataModel<IList>, IDataModelGet<IList>, IDataModelLoad
/// </summary>
public ListTemplateType TemplateType { get; }

/// <summary>
/// Gets the base type for a list.
/// </summary>
public ListBaseType BaseType { get; }

/// <summary>
/// Gets or sets whether verisioning is enabled on the list
/// </summary>
Expand Down

0 comments on commit 792cafa

Please sign in to comment.