Skip to content

Commit 5d2999a

Browse files
author
Andrew Omondi
committed
XML comment additions to source
1 parent 364ede1 commit 5d2999a

2 files changed

Lines changed: 31 additions & 7 deletions

File tree

ConsoleApplication/Helpers/PageIterator.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,28 @@ public class PageIterator
3939
{
4040
private IMailFolderDeltaCollectionPage mailfolders;
4141
private readonly Action<MailFolder> callback;
42+
43+
/// <summary>
44+
/// String token used for making request to Graph API to check
45+
/// for changes in the collection
46+
/// </summary>
4247
public string DeltaLink { get; private set; }
4348

49+
/// <summary>
50+
/// Constructor for the PageIterator
51+
/// <param name="mailFolders">Instance of <see cref="IMailFolderDeltaCollectionPage"/> that holds
52+
/// the collection mail folders to be processed.</param>
53+
/// <param name="callback">Call back to process each item in collection.</param>
54+
/// </summary>
4455
public PageIterator(IMailFolderDeltaCollectionPage mailFolders, Action<MailFolder> callback)
4556
{
4657
this.mailfolders = mailFolders;
4758
this.callback = callback;
4859
}
60+
61+
/// <summary>
62+
/// Iterate through the mailfolders collection and process each item with the provided callback.
63+
/// </summary>
4964
public async Task Iterate()
5065
{
5166
var more = true;
@@ -55,13 +70,16 @@ public async Task Iterate()
5570
{
5671
callback(item);
5772
}
73+
5874
if (mailfolders.NextPageRequest != null)
5975
{
6076
this.mailfolders = await mailfolders.NextPageRequest.GetAsync();
61-
} else
77+
}
78+
else
6279
{
6380
more = false;
6481
}
82+
6583
if (this.mailfolders.AdditionalData.ContainsKey(Constants.DeltaLinkFeedAnnotation))
6684
{
6785
DeltaLink = this.mailfolders.AdditionalData[Constants.DeltaLinkFeedAnnotation] as string;

ConsoleApplication/Program.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ private static void Main()
5555
new string[] { Constants.DefaultScope });
5656

5757
// Start watching mail folders
58-
try {
58+
try
59+
{
5960
Task.Run(() => WatchMailFolders(appConfiguration.PullIntervalSec)).Wait();
6061
}
6162
catch (MsalServiceException mse)
@@ -130,16 +131,21 @@ public static async Task WatchMailFolders(int pullIntervalSec)
130131
}
131132
}
132133

134+
/// <summary>
135+
/// Method for handling exceptions thrown by the MSAL library.
136+
/// </summary>
137+
/// <param name="mse">Intance of an excpetion of the type <see cref="MsalServiceException"/>> </param>
138+
/// <returns></returns>
133139
private static void ProcessMsalException(MsalServiceException mse)
134140
{
135141
switch (mse.ErrorCode)
136142
{
137143
case MsalServiceException.InvalidAuthority:
138-
// What happens: When the library attempts to discover the authority and get the endpoints it
139-
// needs to acquire a token, it got an un-authorize HTTP code or an unexpected response
140-
// Remediation:
141-
// Check that the authority configured for the application, or passed on some overrides
142-
// of token acquisition tokens supporting authority override is correct
144+
// What happens: When the library attempts to discover the authority and get the endpoints it
145+
// needs to acquire a token, it got an un-authorize HTTP code or an unexpected response
146+
// Remediation:
147+
// Check that the authority configured for the application, or passed on some overrides
148+
// of token acquisition tokens supporting authority override is correct
143149
case "unauthorized_client":
144150
// For instance: AADSTS700016: Application with identifier '{clientId}' was not found in the directory '{domain}'.
145151
// This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant.

0 commit comments

Comments
 (0)