Skip to content

Commit 7281811

Browse files
author
Bert Jansen
committed
Support for reading Alerts
1 parent 6086788 commit 7281811

File tree

12 files changed

+2898
-2538
lines changed

12 files changed

+2898
-2538
lines changed

src/sdk/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
66

77
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
88

9+
## [Unreleased]
10+
11+
### Added
12+
13+
- Support for reading Alerts [jansenbe - Bert Jansen]
14+
15+
### Changed
16+
917
## [1.15]
1018

1119
### Added
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using PnP.Core.Model.Security;
2+
using System;
3+
4+
namespace PnP.Core.Model.SharePoint
5+
{
6+
/// <summary>
7+
/// Alert class, write your custom code here
8+
/// </summary>
9+
[SharePointType("SP.Alert", Target = typeof(Web), Uri = "_api/Web/Alerts(guid'{Id}')", Get = "_api/Web/Alerts", LinqGet = "_api/Web/Alerts")]
10+
internal sealed class Alert : BaseDataModel<IAlert>, IAlert
11+
{
12+
#region Construction
13+
public Alert()
14+
{
15+
}
16+
#endregion
17+
18+
#region Properties
19+
20+
public AlertFrequency AlertFrequency { get => GetValue<AlertFrequency>(); set => SetValue(value); }
21+
22+
public string AlertTemplateName { get => GetValue<string>(); set => SetValue(value); }
23+
24+
public DateTime AlertTime { get => GetValue<DateTime>(); set => SetValue(value); }
25+
26+
public AlertType AlertType { get => GetValue<AlertType>(); set => SetValue(value); }
27+
28+
public bool AlwaysNotify { get => GetValue<bool>(); set => SetValue(value); }
29+
30+
public AlertDeliveryMethod DeliveryChannels { get => GetValue<AlertDeliveryMethod>(); set => SetValue(value); }
31+
32+
public AlertEventType EventType { get => GetValue<AlertEventType>(); set => SetValue(value); }
33+
34+
public string Filter { get => GetValue<string>(); set => SetValue(value); }
35+
36+
public Guid Id { get => GetValue<Guid>(); set => SetValue(value); }
37+
38+
public int ItemID { get => GetValue<int>(); set => SetValue(value); }
39+
40+
public Guid ListId { get => GetValue<Guid>(); set => SetValue(value); }
41+
42+
public string ListUrl { get => GetValue<string>(); set => SetValue(value); }
43+
44+
public AlertStatus Status { get => GetValue<AlertStatus>(); set => SetValue(value); }
45+
46+
public string Title { get => GetValue<string>(); set => SetValue(value); }
47+
48+
public int UserId { get => GetValue<int>(); set => SetValue(value); }
49+
50+
public IPropertyValues AllProperties { get => GetModelValue<IPropertyValues>(); }
51+
52+
public IListItem Item { get => GetModelValue<IListItem>(); }
53+
54+
public IList List { get => GetModelValue<IList>(); }
55+
56+
public ISharePointUser User { get => GetModelValue<ISharePointUser>(); }
57+
58+
[KeyProperty(nameof(Id))]
59+
public override object Key { get => Id; set => Id = Guid.Parse(value.ToString()); }
60+
61+
[SharePointProperty("*")]
62+
public object All { get => null; }
63+
64+
#endregion
65+
66+
}
67+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using PnP.Core.QueryModel;
2+
using PnP.Core.Services;
3+
4+
namespace PnP.Core.Model.SharePoint
5+
{
6+
internal sealed class AlertCollection : QueryableDataModelCollection<IAlert>, IAlertCollection
7+
{
8+
public AlertCollection(PnPContext context, IDataModelParent parent, string memberName) : base(context, parent, memberName)
9+
{
10+
PnPContext = context;
11+
Parent = parent;
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)