-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to
Sync-PnPSharePointUserProfilesFromAzureActiveDirectory
a…
…nd `Get-PnPAzureADUser` (#1559) * Fixes for user profile sync * Fixes for user profile syncing * Fixes for user profile sync * Fixes for user profile syncing * Updating changelog * Adding PR reference * Making changelog entry shorter * Update CHANGELOG.md * Update CHANGELOG.md
- Loading branch information
1 parent
250cfde
commit 5c6b198
Showing
8 changed files
with
194 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Commands/Enums/SharePointUserProfileImportProfilePropertiesJobError.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace PnP.PowerShell.Commands.Enums | ||
{ | ||
/// <summary> | ||
/// Types of errors that can occur while performing a SharePoint Online User Profile Import | ||
/// </summary> | ||
public enum SharePointUserProfileImportProfilePropertiesJobError | ||
{ | ||
NoError = 0, | ||
InternalError = 1, | ||
DataFileNotExist = 20, | ||
DataFileNotInTenant = 21, | ||
DataFileTooBig = 22, | ||
InvalidDataFile = 23, | ||
ImportCompleteWithError = 30 | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/Commands/Enums/SharePointUserProfileImportProfilePropertiesJobState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace PnP.PowerShell.Commands.Enums | ||
{ | ||
/// <summary> | ||
/// The states a SharePoint Online User Profile import job can be in | ||
/// </summary> | ||
public enum SharePointUserProfileImportProfilePropertiesJobState | ||
{ | ||
/// <summary> | ||
/// State is unknown | ||
/// </summary> | ||
Unknown = 0, | ||
|
||
/// <summary> | ||
/// The file has been submitted to SharePoint Online for processing | ||
/// </summary> | ||
Submitted = 1, | ||
|
||
/// <summary> | ||
/// The file is currently being processed to validate if it can be used | ||
/// </summary> | ||
Processing = 2, | ||
|
||
/// <summary> | ||
/// The file is queued and being executed | ||
/// </summary> | ||
Queued = 3, | ||
|
||
/// <summary> | ||
/// The import process has completed successfully | ||
/// </summary> | ||
Succeeded = 4, | ||
|
||
/// <summary> | ||
/// The import process has failed to complete | ||
/// </summary> | ||
Error = 5, | ||
|
||
/// <summary> | ||
/// The import process will not start | ||
/// </summary> | ||
WontStart = 99 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/Commands/Model/SharePointUserProfileSync/SharePointUserProfileSyncStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using Microsoft.Online.SharePoint.TenantManagement; | ||
using PnP.PowerShell.Commands.Enums; | ||
|
||
namespace PnP.PowerShell.Commands.Model.SharePoint.SharePointUserProfileSync | ||
{ | ||
/// <summary> | ||
/// Contains the status of a SharePoint Online User Profile Import job | ||
/// </summary> | ||
public class SharePointUserProfileSyncStatus | ||
{ | ||
#region Properties | ||
|
||
/// <summary> | ||
/// Details on the type of error that occurred, if any | ||
/// </summary> | ||
public SharePointUserProfileImportProfilePropertiesJobError Error { get; set; } | ||
|
||
/// <summary> | ||
/// The error message, if an error occurred | ||
/// </summary> | ||
public string ErrorMessage { get; set; } | ||
|
||
/// <summary> | ||
/// Unique identifier of the import job | ||
/// </summary> | ||
public Guid? JobId { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public string LogFolderUri { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public string SourceUri { get; set; } | ||
|
||
/// <summary> | ||
/// State the user profile import process is in | ||
/// </summary> | ||
public SharePointUserProfileImportProfilePropertiesJobState State { get; set; } | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
/// <summary> | ||
/// Takes an instance of ImportProfilePropertiesJobInfo from CSOM and maps it to a local SharePointUserProfileSyncStatus entity | ||
/// </summary> | ||
/// <param name="importProfilePropertiesJobInfo">Instance to map from</param> | ||
public static SharePointUserProfileSyncStatus ParseFromImportProfilePropertiesJobInfo(ImportProfilePropertiesJobInfo importProfilePropertiesJobInfo) | ||
{ | ||
var result = new SharePointUserProfileSyncStatus | ||
{ | ||
Error = Enum.TryParse(importProfilePropertiesJobInfo.Error.ToString(), out SharePointUserProfileImportProfilePropertiesJobError sharePointUserProfileImportProfilePropertiesJobError) ? sharePointUserProfileImportProfilePropertiesJobError : SharePointUserProfileImportProfilePropertiesJobError.NoError, | ||
ErrorMessage = importProfilePropertiesJobInfo.ErrorMessage, | ||
JobId = importProfilePropertiesJobInfo.JobId, | ||
LogFolderUri = importProfilePropertiesJobInfo.LogFolderUri, | ||
SourceUri = importProfilePropertiesJobInfo.SourceUri, | ||
State = Enum.TryParse(importProfilePropertiesJobInfo.State.ToString(), out SharePointUserProfileImportProfilePropertiesJobState sharePointUserProfileImportProfilePropertiesJobState) ? sharePointUserProfileImportProfilePropertiesJobState : SharePointUserProfileImportProfilePropertiesJobState.Unknown | ||
}; | ||
return result; | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.