diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca9816bc9..2271b6cd43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Changed `Get-PnPContainer`, `Remove-PnPContainer` and `Restore-PnPDeletedContainer` to accept the api url of a container, such as the `ContainerApiUrl` returned by `Get-PnPContainer`, and `Remove-PnPContainer` to accept the containers returned by `Get-PnPContainer` from the pipeline. [#5487](https://github.com/pnp/powershell/pull/5487) - Changed `Get-PnPContainerTypeConfiguration` to also return the application redirect url, the sharing allow lists and their tenant overrides, the Copilot embedded chat hosts, the anonymous link expiration, and whether archiving and the legacy item web url are enabled. [#5487](https://github.com/pnp/powershell/pull/5487) - Changed `New-PnPContainerType` to create a standard container type when `-TrialContainerType` is not used, instead of writing a warning and creating nothing. `-AzureSubscriptionId`, `-ResourceGroup` and `-Region` are marked obsolete and are ignored; set up the billing of a standard container type separately, for example with `Add-SPOContainerTypeBilling`. [#5487](https://github.com/pnp/powershell/pull/5487) +- Marked `Get-PnPSyntexModel`, `Get-PnPSyntexModelPublication`, `Publish-PnPSyntexModel`, `Unpublish-PnPSyntexModel` and `Request-PnPSyntexClassifyAndExtract` as obsolete, as SharePoint Syntex is no longer supported and its support has been removed from the PnP Core SDK. The cmdlets are kept for backwards compatibility with existing scripts, but no longer do anything other than write a warning, no longer require a connection, and will be removed in a future version. `-PublicationViewOption` on `Publish-PnPSyntexModel` now takes a string and `-Connection` is ignored. [#5496](https://github.com/pnp/powershell/pull/5496) ### Fixed - Using UPNs with an apostrophe in it not working with `Remove-PnPUserProfile`, `Export-PnPUserProfile`, `Export-PnPUserInfo`, and `Remove-PnPUserInfo`. The apostrophe is now escaped in the API request. [#5459](https://github.com/pnp/powershell/pull/5459) diff --git a/documentation/Get-PnPSyntexModel.md b/documentation/Get-PnPSyntexModel.md index d5bc007f41..24526feee4 100644 --- a/documentation/Get-PnPSyntexModel.md +++ b/documentation/Get-PnPSyntexModel.md @@ -9,6 +9,9 @@ online version: https://pnp.github.io/powershell/cmdlets/Get-PnPSyntexModel.html # Get-PnPSyntexModel +> [!WARNING] +> This cmdlet is obsolete and no longer does anything, as SharePoint Syntex is no longer supported. It only writes a warning and will be removed in a future version. + ## SYNOPSIS Returns Microsoft Syntex models from a Syntex Content Center. @@ -51,7 +54,7 @@ Gets the document processing model named "Invoice model". ## PARAMETERS ### -Connection -Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. +Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts. ```yaml Type: PnPConnection diff --git a/documentation/Get-PnPSyntexModelPublication.md b/documentation/Get-PnPSyntexModelPublication.md index 325bcf9598..b1e78a2367 100644 --- a/documentation/Get-PnPSyntexModelPublication.md +++ b/documentation/Get-PnPSyntexModelPublication.md @@ -9,6 +9,9 @@ online version: https://pnp.github.io/powershell/cmdlets/Get-PnPSyntexModelPubli # Get-PnPSyntexModelPublication +> [!WARNING] +> This cmdlet is obsolete and no longer does anything, as SharePoint Syntex is no longer supported. It only writes a warning and will be removed in a future version. + ## SYNOPSIS Returns the libraries to which a Microsoft Syntex model was published. @@ -36,7 +39,7 @@ Gets the libraries to which the document processing model named "Invoice model" ## PARAMETERS ### -Connection -Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. +Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts. ```yaml Type: PnPConnection diff --git a/documentation/Publish-PnPSyntexModel.md b/documentation/Publish-PnPSyntexModel.md index 270debf552..6cdfdf11bb 100644 --- a/documentation/Publish-PnPSyntexModel.md +++ b/documentation/Publish-PnPSyntexModel.md @@ -9,6 +9,9 @@ online version: https://pnp.github.io/powershell/cmdlets/Publish-PnPSyntexModel. # Publish-PnPSyntexModel +> [!WARNING] +> This cmdlet is obsolete and no longer does anything, as SharePoint Syntex is no longer supported. It only writes a warning and will be removed in a future version. + ## SYNOPSIS Publishes Microsoft Syntex models to a list. @@ -24,14 +27,14 @@ This cmdlet only works when you've connected to a Syntex Content Center site. ### Single ```powershell -Publish-PnPSyntexModel -Model -ListWebUrl -List [-PublicationViewOption ] [-Connection ] +Publish-PnPSyntexModel -Model -ListWebUrl -List [-PublicationViewOption ] [-Connection ] ``` ### Batched ```powershell -Publish-PnPSyntexModel -Model -TargetSiteUrl -TargetWebServerRelativeUrl -TargetLibraryServerRelativeUrl -Batch [-PublicationViewOption ] [-Connection ] +Publish-PnPSyntexModel -Model -TargetSiteUrl -TargetWebServerRelativeUrl -TargetLibraryServerRelativeUrl -Batch [-PublicationViewOption ] [-Connection ] ``` @@ -61,7 +64,7 @@ Adds the publishing of the document processing model named "Invoice model" to th ### -Connection -Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. +Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts. ```yaml Type: PnPConnection @@ -189,13 +192,12 @@ Accept wildcard characters: False The view options to apply when publishing the model to the list. ```yaml -Type: MachineLearningPublicationViewOption +Type: String Parameter Sets: (All) -Accepted values: NewView, NewViewAsDefault, NoNewView Required: False Position: Named -Default value: NewViewAsDefault +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/documentation/Request-PnPSyntexClassifyAndExtract.md b/documentation/Request-PnPSyntexClassifyAndExtract.md index 98751a8600..e510259ce6 100644 --- a/documentation/Request-PnPSyntexClassifyAndExtract.md +++ b/documentation/Request-PnPSyntexClassifyAndExtract.md @@ -9,6 +9,9 @@ online version: https://pnp.github.io/powershell/cmdlets/Request-PnPSyntexClassi # Request-PnPSyntexClassifyAndExtract +> [!WARNING] +> This cmdlet is obsolete and no longer does anything, as SharePoint Syntex is no longer supported. It only writes a warning and will be removed in a future version. + ## SYNOPSIS Requests for a file, folder or all files in a library to be classified and extracted via the published Microsoft Syntex models on the libraries hosting the files. @@ -76,7 +79,7 @@ Requests the classification and extraction of all files in the folder "jan" in l ### -Connection -Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. +Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts. ```yaml Type: PnPConnection diff --git a/documentation/Unpublish-PnPSyntexModel.md b/documentation/Unpublish-PnPSyntexModel.md index 2cdb3fc25b..12655d4ac1 100644 --- a/documentation/Unpublish-PnPSyntexModel.md +++ b/documentation/Unpublish-PnPSyntexModel.md @@ -9,6 +9,9 @@ online version: https://pnp.github.io/powershell/cmdlets/Unpublish-PnPSyntexMode # Unpublish-PnPSyntexModel +> [!WARNING] +> This cmdlet is obsolete and no longer does anything, as SharePoint Syntex is no longer supported. It only writes a warning and will be removed in a future version. + ## SYNOPSIS Unpublishes a Microsoft Syntex model from a list. @@ -61,7 +64,7 @@ Adds the unpublishing of the document processing model named "Invoice model" fro ### -Connection -Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. +Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts. ```yaml Type: PnPConnection diff --git a/pages/articles/batching.md b/pages/articles/batching.md index 9ec724bc74..bef1619fd8 100644 --- a/pages/articles/batching.md +++ b/pages/articles/batching.md @@ -52,6 +52,3 @@ The following cmdlets support batching. (This support began with the 1.7.63-nigh * [`Add-PnPListItem`](/powershell/cmdlets/Add-PnPListItem.html) * [`Set-PnPListItem`](/powershell/cmdlets/Set-PnPListItem.html) * [`Remove-PnPListItem`](/powershell/cmdlets/Remove-PnPListItem.html) -* [`Publish-PnPSyntexModel`](/powershell/cmdlets/Publish-PnPSyntexModel.html) -* [`Unpublish-PnPSyntexModel`](/powershell/cmdlets/Unpublish-PnPSyntexModel.html) -* [`Request-PnPSyntexClassifyAndExtract`](/powershell/cmdlets/Request-PnPSyntexClassifyAndExtract.html) diff --git a/src/Commands/Base/PipeBinds/SyntexModelPipeBind.cs b/src/Commands/Base/PipeBinds/SyntexModelPipeBind.cs index 4fb418425a..b1e8051c8b 100644 --- a/src/Commands/Base/PipeBinds/SyntexModelPipeBind.cs +++ b/src/Commands/Base/PipeBinds/SyntexModelPipeBind.cs @@ -1,20 +1,9 @@ -using PnP.Core.Model.SharePoint; -using PnP.PowerShell.Commands.Model; -using System; -using System.Linq; - -namespace PnP.PowerShell.Commands.Base.PipeBinds +namespace PnP.PowerShell.Commands.Base.PipeBinds { public sealed class SyntexModelPipeBind { private readonly int syntexModelId; private readonly string syntexModelName; - private readonly ISyntexModel syntexModel; - - public SyntexModelPipeBind(ISyntexModel syntexModel) - { - this.syntexModel = syntexModel; - } public SyntexModelPipeBind(string name) { @@ -26,80 +15,10 @@ public SyntexModelPipeBind(int id) this.syntexModelId = id; } - public ISyntexModel SyntexModel => syntexModel; - public string Name => syntexModelName; public int Id => syntexModelId; public override string ToString() => Name; - - internal ISyntexModel GetSyntexModel(PnPConnection connection) - { - if (syntexModel != null) - { - return syntexModel; - } - else if (syntexModelId > 0) - { - var ctx = connection.PnPContext; - var syntexContentCenter = ctx.Web.AsSyntexContentCenter(); - var models = syntexContentCenter.GetSyntexModels(); - return models.FirstOrDefault(p => p.Id == syntexModelId); - } - else if (!string.IsNullOrEmpty(syntexModelName)) - { - var ctx = connection.PnPContext; - var syntexContentCenter = ctx.Web.AsSyntexContentCenter(); - var models = syntexContentCenter.GetSyntexModels(); - return models.FirstOrDefault(p => p.Name.Equals(syntexModelName, StringComparison.InvariantCultureIgnoreCase)); - } - else - { - return null; - } - } - - internal ISyntexModel GetSyntexModel(PnPBatch batch, PnPConnection connection) - { - if (syntexModel != null) - { - return syntexModel; - } - else if (syntexModelId > 0) - { - var batchedSyntexModel = batch.GetCachedSyntexModel(syntexModelId); - if (batchedSyntexModel != null) - { - return batchedSyntexModel; - } - - var ctx = connection.PnPContext; - var syntexContentCenter = ctx.Web.AsSyntexContentCenter(); - var models = syntexContentCenter.GetSyntexModels(); - var syntexModel = models.FirstOrDefault(p => p.Id == syntexModelId); - batch.CacheSyntexModel(syntexModel); - return syntexModel; - } - else if (!string.IsNullOrEmpty(syntexModelName)) - { - var batchedSyntexModel = batch.GetCachedSyntexModel(syntexModelName); - if (batchedSyntexModel != null) - { - return batchedSyntexModel; - } - - var ctx = connection.PnPContext; - var syntexContentCenter = ctx.Web.AsSyntexContentCenter(); - var models = syntexContentCenter.GetSyntexModels(); - var syntexModel = models.FirstOrDefault(p => p.Name.Equals(syntexModelName, StringComparison.InvariantCultureIgnoreCase)); - batch.CacheSyntexModel(syntexModel); - return syntexModel; - } - else - { - return null; - } - } } } diff --git a/src/Commands/Model/PnPBatch.cs b/src/Commands/Model/PnPBatch.cs index 8a19555072..d0c9e39435 100644 --- a/src/Commands/Model/PnPBatch.cs +++ b/src/Commands/Model/PnPBatch.cs @@ -18,8 +18,6 @@ public class PnPBatch internal List ContentTypes { get; set; } = new List(); internal List<(string key, Guid id, string label)> Terms { get; set; } = new List<(string key, Guid id, string label)>(); - internal List SyntexModels { get; set; } = new List(); - internal int? DefaultTermStoreLanguage { get; set; } internal TaxonomySession TaxonomySession { get; set; } internal Microsoft.SharePoint.Client.Taxonomy.TermStore TermStore { get; set; } @@ -56,7 +54,6 @@ internal void ClearCache() { Lists.Clear(); ContentTypes.Clear(); - SyntexModels.Clear(); } internal IList GetCachedList(Guid id) @@ -84,16 +81,6 @@ internal IContentType GetCachedContentType(string idOrName) return ct; } - internal ISyntexModel GetCachedSyntexModel(int id) - { - return SyntexModels.FirstOrDefault(c => c.Id == id); - } - - internal ISyntexModel GetCachedSyntexModel(string modelName) - { - return SyntexModels.FirstOrDefault(c => c.Name == modelName); - } - internal void CacheList(IList list) { var existingList = Lists.FirstOrDefault(l => l.Id == list.Id); @@ -115,17 +102,6 @@ internal void CacheContentType(IContentType contentType) ContentTypes.Add(contentType); } - internal void CacheSyntexModel(ISyntexModel model) - { - var existingModel = SyntexModels.FirstOrDefault(c => c.UniqueId == model.UniqueId); - if (existingModel != null) - { - SyntexModels.Remove(existingModel); - } - - SyntexModels.Add(model); - } - internal void CacheTerm(string key, Guid id, string label) { this.Terms.Add((key, id, label)); diff --git a/src/Commands/Model/Syntex/SyntexClassifyAndExtractResult.cs b/src/Commands/Model/Syntex/SyntexClassifyAndExtractResult.cs deleted file mode 100644 index c864c19c50..0000000000 --- a/src/Commands/Model/Syntex/SyntexClassifyAndExtractResult.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; - -namespace PnP.PowerShell.Commands.Model.Syntex -{ - /// - /// Result of a classify and extract operation requested for a file - /// - public class SyntexClassifyAndExtractResult - { - /// - /// Date of the classify and extract request creation - /// - public DateTime Created { get; internal set; } - - /// - /// Date of the classify and extract request delivery - /// - public DateTime DeliverDate { get; internal set; } - - /// - /// Id of the classify and extract request - /// - public Guid Id { get; internal set; } - - /// - /// Type of this Syntex machine learning work item - /// - public Guid WorkItemType { get; internal set; } - - /// - /// The classify and extract error (if there was any) - /// - public string ErrorMessage { get; internal set; } - - /// - /// The status code of the classify and extract request, 2xx == success - /// - public int StatusCode { get; internal set; } - - /// - /// Status of the classify and extract request - /// - public string Status { get; internal set; } - - /// - /// Server relative url of the file requested to be classified and extracted - /// - public string TargetServerRelativeUrl { get; internal set; } - - /// - /// Url of the site containing the file requested to be classified and extracted - /// - public string TargetSiteUrl { get; internal set; } - - /// - /// Server relative url of the web containing the file requested to be classified and extracted - /// - public string TargetWebServerRelativeUrl { get; internal set; } - } -} diff --git a/src/Commands/Model/Syntex/SyntexModel.cs b/src/Commands/Model/Syntex/SyntexModel.cs deleted file mode 100644 index bf7d10cefa..0000000000 --- a/src/Commands/Model/Syntex/SyntexModel.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -namespace PnP.PowerShell.Commands.Model.Syntex -{ - /// - /// Syntex model - /// - public class SyntexModel - { - /// - /// Id of a model (= id of the list item) - /// - public int Id { get; internal set; } - - /// - /// Unique id of the model (= unique id of the model file) - /// - public Guid UniqueId { get; internal set; } - - /// - /// Name of the model - /// - public string Name { get; internal set; } - - /// - /// Model description - /// - public string Description { get; internal set; } - - /// - /// Date when the model was trained for the last time - /// - public DateTime ModelLastTrained { get; internal set; } - } -} diff --git a/src/Commands/Model/Syntex/SyntexModelPublication.cs b/src/Commands/Model/Syntex/SyntexModelPublication.cs deleted file mode 100644 index 58371d1556..0000000000 --- a/src/Commands/Model/Syntex/SyntexModelPublication.cs +++ /dev/null @@ -1,36 +0,0 @@ -using PnP.Core.Model.SharePoint; -using System; - -namespace PnP.PowerShell.Commands.Model.Syntex -{ - /// - /// Defines a model publication - /// - public class SyntexModelPublication - { - /// - /// Unique id of the SharePoint Syntex model - /// - public Guid ModelUniqueId { get; internal set; } - - /// - /// Server relative url of the library registered with the model - /// - public string TargetLibraryServerRelativeUrl { get; internal set; } - - /// - /// Fully qualified URL of the site collection holding the library registered with the model - /// - public string TargetSiteUrl { get; internal set; } - - /// - /// Server relative url of the web holding the library registered with the model - /// - public string TargetWebServerRelativeUrl { get; internal set; } - - /// - /// The view option specified when registering the model with the library - /// - public MachineLearningPublicationViewOption ViewOption { get; internal set; } - } -} diff --git a/src/Commands/Model/Syntex/SyntexPublicationResult.cs b/src/Commands/Model/Syntex/SyntexPublicationResult.cs deleted file mode 100644 index 138b2ede31..0000000000 --- a/src/Commands/Model/Syntex/SyntexPublicationResult.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace PnP.PowerShell.Commands.Model.Syntex -{ - /// - /// The result of a SharePoint Syntex model publication - /// - public class SyntexPublicationResult - { - /// - /// The publication error (if there was any) - /// - public string ErrorMessage { get; internal set; } - - /// - /// The published model - /// - public SyntexModelPublication Publication { get; internal set; } - - /// - /// The status code of the publication, 2xx == success - /// - public int StatusCode { get; internal set; } - } -} diff --git a/src/Commands/Syntex/GetSyntexModel.cs b/src/Commands/Syntex/GetSyntexModel.cs index cfbdd8022b..582ec97a5e 100644 --- a/src/Commands/Syntex/GetSyntexModel.cs +++ b/src/Commands/Syntex/GetSyntexModel.cs @@ -1,53 +1,19 @@ -using PnP.PowerShell.Commands.Base.PipeBinds; -using PnP.PowerShell.Commands.Model.Syntex; -using System.Collections.Generic; +using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base.PipeBinds; +using System; using System.Management.Automation; namespace PnP.PowerShell.Commands.Syntex { [Cmdlet(VerbsCommon.Get, "PnPSyntexModel")] - [OutputType(typeof(SyntexModel))] - public class GetSyntexModel : PnPWebCmdlet + [Obsolete("It no longer does anything, as SharePoint Syntex is no longer supported, and will be removed in a future version.")] + [Attributes.ApiPermissionsNotRequired(Remarks = "This cmdlet performs no request.")] + public class GetSyntexModel : BasePSCmdlet { - [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0)] public SyntexModelPipeBind Identity; - protected override void ExecuteCmdlet() - { - var ctx = Connection.PnPContext; - - if (ctx.Web.IsSyntexContentCenter()) - { - if (ParameterSpecified(nameof(Identity)) && Identity != null) - { - WriteObject(Identity.GetSyntexModel(Connection)); - } - else - { - var syntexContentCenter = ctx.Web.AsSyntexContentCenter(); - var models = syntexContentCenter.GetSyntexModels(); - - List modelsToOutput = new List(); - foreach(var model in models) - { - modelsToOutput.Add(new SyntexModel() - { - Id = model.Id, - Description = model.Description, - ModelLastTrained = model.ModelLastTrained, - Name = model.Name, - UniqueId = model.UniqueId - }); - } - - WriteObject(modelsToOutput, true); - } - } - else - { - LogWarning("The connected site is not a Syntex Content Center site"); - } - } + [Parameter(Mandatory = false, HelpMessage = "Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts.")] + public PnPConnection Connection = null; } } diff --git a/src/Commands/Syntex/GetSyntexModelPublication.cs b/src/Commands/Syntex/GetSyntexModelPublication.cs index 36b3cccc67..d901d85bef 100644 --- a/src/Commands/Syntex/GetSyntexModelPublication.cs +++ b/src/Commands/Syntex/GetSyntexModelPublication.cs @@ -1,52 +1,19 @@ -using PnP.Core.Model.SharePoint; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; -using System.Collections.Generic; +using System; using System.Management.Automation; namespace PnP.PowerShell.Commands.Syntex { [Cmdlet(VerbsCommon.Get, "PnPSyntexModelPublication")] - [OutputType(typeof(Model.Syntex.SyntexModelPublication))] - public class GetSyntexModelPublication : PnPWebCmdlet + [Obsolete("It no longer does anything, as SharePoint Syntex is no longer supported, and will be removed in a future version.")] + [Attributes.ApiPermissionsNotRequired(Remarks = "This cmdlet performs no request.")] + public class GetSyntexModelPublication : BasePSCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] public SyntexModelPipeBind Model; - protected override void ExecuteCmdlet() - { - var ctx = Connection.PnPContext; - - if (ctx.Web.IsSyntexContentCenter()) - { - // Get the model we're publishing - ISyntexModel model = Model.GetSyntexModel(Connection); - - if (model == null) - { - throw new PSArgumentException("Provide a valid model to get publications for"); - } - - var modelPublications = model.GetModelPublications(); - - List modelPublicationsToOutput = new List(); - - foreach(var modelPublication in modelPublications) - { - modelPublicationsToOutput.Add(new Model.Syntex.SyntexModelPublication() - { - ModelUniqueId = modelPublication.ModelUniqueId, - TargetLibraryServerRelativeUrl = modelPublication.TargetLibraryServerRelativeUrl, - TargetSiteUrl = modelPublication.TargetSiteUrl, - TargetWebServerRelativeUrl = modelPublication.TargetWebServerRelativeUrl, - ViewOption = modelPublication.ViewOption - }); - } - WriteObject(modelPublicationsToOutput); - } - else - { - LogWarning("The connected site is not a Syntex Content Center site"); - } - } + [Parameter(Mandatory = false, HelpMessage = "Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts.")] + public PnPConnection Connection = null; } } diff --git a/src/Commands/Syntex/PublishSyntexModel.cs b/src/Commands/Syntex/PublishSyntexModel.cs index c144504f4c..b2d70f9c29 100644 --- a/src/Commands/Syntex/PublishSyntexModel.cs +++ b/src/Commands/Syntex/PublishSyntexModel.cs @@ -1,16 +1,16 @@ -using PnP.Core.Model.SharePoint; -using PnP.Framework; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.Completers; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Model; -using PnP.PowerShell.Commands.Model.Syntex; +using System; using System.Management.Automation; namespace PnP.PowerShell.Commands.Syntex { [Cmdlet(VerbsData.Publish, "PnPSyntexModel")] - [OutputType(typeof(SyntexPublicationResult))] - public class PublishSyntexModel : PnPWebCmdlet + [Obsolete("It no longer does anything, as SharePoint Syntex is no longer supported, and will be removed in a future version.")] + [Attributes.ApiPermissionsNotRequired(Remarks = "This cmdlet performs no request.")] + public class PublishSyntexModel : BasePSCmdlet { const string ParameterSet_SINGLE = "Single"; const string Parameterset_BATCHED = "Batched"; @@ -26,7 +26,7 @@ public class PublishSyntexModel : PnPWebCmdlet public ListPipeBind List; [Parameter(Mandatory = false)] - public MachineLearningPublicationViewOption PublicationViewOption = MachineLearningPublicationViewOption.NewViewAsDefault; + public string PublicationViewOption; [Parameter(Mandatory = true, ParameterSetName = Parameterset_BATCHED)] public string TargetSiteUrl; @@ -41,76 +41,7 @@ public class PublishSyntexModel : PnPWebCmdlet [ValidateNotNull] public PnPBatch Batch; - protected override void ExecuteCmdlet() - { - var ctx = Connection.PnPContext; - - if (ctx.Web.IsSyntexContentCenter()) - { - if (ParameterSpecified(nameof(Batch))) - { - // Get the model we're publishing - ISyntexModel modelToPublish = Model.GetSyntexModel(Batch, Connection); - - if (modelToPublish == null) - { - throw new PSArgumentException("Provide a valid model to publish"); - } - - modelToPublish.PublishModelBatch(Batch.Batch, new SyntexModelPublishOptions() - { - TargetSiteUrl = TargetSiteUrl, - TargetWebServerRelativeUrl = TargetWebServerRelativeUrl, - TargetLibraryServerRelativeUrl = TargetLibraryServerRelativeUrl, - ViewOption = PublicationViewOption - }); - } - else - { - // Get the model we're publishing - ISyntexModel modelToPublish = Model.GetSyntexModel(Connection); - - if (modelToPublish == null) - { - throw new PSArgumentException("Provide a valid model to publish"); - } - - // resolve the list - IList listToPublishModelTo = null; - using (var listContext = Connection.CloneContext(ListWebUrl)) - { - var pnpContext = PnPCoreSdk.Instance.GetPnPContext(listContext); - listToPublishModelTo = List.GetList(pnpContext); - } - - if (listToPublishModelTo == null) - { - throw new PSArgumentException("Provide a valid list to publish the Syntex model to"); - } - - var publishResult = modelToPublish.PublishModel(listToPublishModelTo, PublicationViewOption); - if (publishResult != null) - { - WriteObject(new SyntexPublicationResult() - { - ErrorMessage = publishResult.ErrorMessage, - StatusCode = publishResult.StatusCode, - Publication = new Model.Syntex.SyntexModelPublication() - { - ModelUniqueId = publishResult.Publication.ModelUniqueId, - TargetSiteUrl = publishResult.Publication.TargetSiteUrl, - TargetWebServerRelativeUrl = publishResult.Publication.TargetWebServerRelativeUrl, - TargetLibraryServerRelativeUrl = publishResult.Publication.TargetLibraryServerRelativeUrl, - ViewOption = publishResult.Publication.ViewOption - } - }); - } - } - } - else - { - LogWarning("The connected site is not a Syntex Content Center site"); - } - } + [Parameter(Mandatory = false, HelpMessage = "Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts.")] + public PnPConnection Connection = null; } } diff --git a/src/Commands/Syntex/RequestSyntexClassifyAndExtract.cs b/src/Commands/Syntex/RequestSyntexClassifyAndExtract.cs index 6389d0ad88..103cdc3f96 100644 --- a/src/Commands/Syntex/RequestSyntexClassifyAndExtract.cs +++ b/src/Commands/Syntex/RequestSyntexClassifyAndExtract.cs @@ -1,19 +1,16 @@ -using PnP.Core.Model.SharePoint; -using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.Completers; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Model; -using PnP.PowerShell.Commands.Model.Syntex; - -using System.Collections.Generic; -using System.Linq; +using System; using System.Management.Automation; namespace PnP.PowerShell.Commands.Syntex { [Cmdlet(VerbsLifecycle.Request, "PnPSyntexClassifyAndExtract")] - [OutputType(typeof(SyntexClassifyAndExtractResult))] - public class RequestSyntexClassifyAndExtract : PnPWebCmdlet + [Obsolete("It no longer does anything, as SharePoint Syntex is no longer supported, and will be removed in a future version.")] + [Attributes.ApiPermissionsNotRequired(Remarks = "This cmdlet performs no request.")] + public class RequestSyntexClassifyAndExtract : BasePSCmdlet { const string ParameterSet_LIST = "List"; const string Parameterset_FILE = "File"; @@ -38,126 +35,7 @@ public class RequestSyntexClassifyAndExtract : PnPWebCmdlet [Parameter(Mandatory = true, ParameterSetName = Parameterset_FOLDER)] public FolderPipeBind Folder; - - protected override void ExecuteCmdlet() - { - var serverRelativeUrl = string.Empty; - var ctx = Connection.PnPContext; - - if (ParameterSpecified(nameof(List))) - { - IList list = List.GetList(ctx); - - // If a list is above 5K we default to off-peak processing - if (list.ItemCount > 5000) - { - OffPeak = true; - } - - if (OffPeak) - { - var classifyAndExtractResult = list.ClassifyAndExtractOffPeak(); - WriteObject(new SyntexClassifyAndExtractResult() - { - Created = classifyAndExtractResult.Created, - DeliverDate = classifyAndExtractResult.DeliverDate, - ErrorMessage = classifyAndExtractResult.ErrorMessage, - Id = classifyAndExtractResult.Id, - Status = classifyAndExtractResult.Status, - StatusCode = classifyAndExtractResult.StatusCode, - TargetServerRelativeUrl = classifyAndExtractResult.TargetServerRelativeUrl, - TargetSiteUrl = classifyAndExtractResult.TargetSiteUrl, - TargetWebServerRelativeUrl = classifyAndExtractResult.TargetWebServerRelativeUrl, - WorkItemType = classifyAndExtractResult.WorkItemType, - }); - } - else - { - var classifyAndExtractResults = list.ClassifyAndExtract(force: Force.IsPresent); - - List classifyAndExtractResultsOutput = new List(); - if (classifyAndExtractResults != null && classifyAndExtractResults.Any()) - { - foreach (var classifyAndExtractResult in classifyAndExtractResults) - { - classifyAndExtractResultsOutput.Add(new SyntexClassifyAndExtractResult() - { - Created = classifyAndExtractResult.Created, - DeliverDate = classifyAndExtractResult.DeliverDate, - ErrorMessage = classifyAndExtractResult.ErrorMessage, - Id = classifyAndExtractResult.Id, - Status = classifyAndExtractResult.Status, - StatusCode = classifyAndExtractResult.StatusCode, - TargetServerRelativeUrl = classifyAndExtractResult.TargetServerRelativeUrl, - TargetSiteUrl = classifyAndExtractResult.TargetSiteUrl, - TargetWebServerRelativeUrl = classifyAndExtractResult.TargetWebServerRelativeUrl, - WorkItemType = classifyAndExtractResult.WorkItemType, - }); - } - } - WriteObject(classifyAndExtractResultsOutput, true); - } - - } - else if (ParameterSpecified(nameof(Folder))) - { - IFolder folder = Folder.GetFolder(ctx); - var classifyAndExtractResult = folder.ClassifyAndExtractOffPeak(); - WriteObject(new SyntexClassifyAndExtractResult() - { - Created = classifyAndExtractResult.Created, - DeliverDate = classifyAndExtractResult.DeliverDate, - ErrorMessage = classifyAndExtractResult.ErrorMessage, - Id = classifyAndExtractResult.Id, - Status = classifyAndExtractResult.Status, - StatusCode = classifyAndExtractResult.StatusCode, - TargetServerRelativeUrl = classifyAndExtractResult.TargetServerRelativeUrl, - TargetSiteUrl = classifyAndExtractResult.TargetSiteUrl, - TargetWebServerRelativeUrl = classifyAndExtractResult.TargetWebServerRelativeUrl, - WorkItemType = classifyAndExtractResult.WorkItemType, - }); - } - else - { - ctx.Web.EnsureProperties(w => w.ServerRelativeUrl); - - if (!FileUrl.ToLower().StartsWith(ctx.Web.ServerRelativeUrl.ToLower())) - { - serverRelativeUrl = UrlUtility.Combine(ctx.Web.ServerRelativeUrl, FileUrl); - } - else - { - serverRelativeUrl = FileUrl; - } - - var file = ctx.Web.GetFileByServerRelativeUrl(serverRelativeUrl); - - if (ParameterSpecified(nameof(Batch))) - { - file.ClassifyAndExtractBatch(Batch.Batch); - } - else - { - var classifyAndExtractResult = file.ClassifyAndExtract(); - - if (classifyAndExtractResult != null) - { - WriteObject(new SyntexClassifyAndExtractResult() - { - Created = classifyAndExtractResult.Created, - DeliverDate = classifyAndExtractResult.DeliverDate, - ErrorMessage = classifyAndExtractResult.ErrorMessage, - Id = classifyAndExtractResult.Id, - Status = classifyAndExtractResult.Status, - StatusCode = classifyAndExtractResult.StatusCode, - TargetServerRelativeUrl = classifyAndExtractResult.TargetServerRelativeUrl, - TargetSiteUrl = classifyAndExtractResult.TargetSiteUrl, - TargetWebServerRelativeUrl = classifyAndExtractResult.TargetWebServerRelativeUrl, - WorkItemType = classifyAndExtractResult.WorkItemType, - }); - } - } - } - } + [Parameter(Mandatory = false, HelpMessage = "Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts.")] + public PnPConnection Connection = null; } } diff --git a/src/Commands/Syntex/UnPublishSyntexModel.cs b/src/Commands/Syntex/UnPublishSyntexModel.cs index bd8496ac65..1c8a3f1059 100644 --- a/src/Commands/Syntex/UnPublishSyntexModel.cs +++ b/src/Commands/Syntex/UnPublishSyntexModel.cs @@ -1,16 +1,16 @@ -using PnP.Core.Model.SharePoint; -using PnP.Framework; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.Completers; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Model; -using PnP.PowerShell.Commands.Model.Syntex; +using System; using System.Management.Automation; namespace PnP.PowerShell.Commands.Syntex { [Cmdlet(VerbsData.Unpublish, "PnPSyntexModel")] - [OutputType(typeof(SyntexPublicationResult))] - public class UnPublishSyntexModel : PnPWebCmdlet + [Obsolete("It no longer does anything, as SharePoint Syntex is no longer supported, and will be removed in a future version.")] + [Attributes.ApiPermissionsNotRequired(Remarks = "This cmdlet performs no request.")] + public class UnPublishSyntexModel : BasePSCmdlet { const string ParameterSet_SINGLE = "Single"; const string Parameterset_BATCHED = "Batched"; @@ -38,75 +38,7 @@ public class UnPublishSyntexModel : PnPWebCmdlet [ValidateNotNull] public PnPBatch Batch; - protected override void ExecuteCmdlet() - { - var ctx = Connection.PnPContext; - - if (ctx.Web.IsSyntexContentCenter()) - { - if (ParameterSpecified(nameof(Batch))) - { - // Get the model we're publishing - ISyntexModel modelToPublish = Model.GetSyntexModel(Batch, Connection); - - if (modelToPublish == null) - { - throw new PSArgumentException("Provide a valid model to publish"); - } - - modelToPublish.UnPublishModelBatch(Batch.Batch, new SyntexModelUnPublishOptions() - { - TargetSiteUrl = TargetSiteUrl, - TargetWebServerRelativeUrl = TargetWebServerRelativeUrl, - TargetLibraryServerRelativeUrl = TargetLibraryServerRelativeUrl, - }); - } - else - { - // Get the model we're publishing - ISyntexModel modelToUnPublish = Model.GetSyntexModel(Connection); - - if (modelToUnPublish == null) - { - throw new PSArgumentException("Provide a valid model to unpublish"); - } - - // resolve the list - IList listToUnPublishModelFrom = null; - using (var listContext = Connection.CloneContext(ListWebUrl)) - { - var pnpContext = PnPCoreSdk.Instance.GetPnPContext(listContext); - listToUnPublishModelFrom = List.GetList(pnpContext); - } - - if (listToUnPublishModelFrom == null) - { - throw new PSArgumentException("Provide a valid list to unpublish the Syntex model from"); - } - - var unPublishResult = modelToUnPublish.UnPublishModel(listToUnPublishModelFrom); - if (unPublishResult != null) - { - WriteObject(new SyntexPublicationResult() - { - ErrorMessage = unPublishResult.ErrorMessage, - StatusCode = unPublishResult.StatusCode, - Publication = new Model.Syntex.SyntexModelPublication() - { - ModelUniqueId = unPublishResult.Publication.ModelUniqueId, - TargetSiteUrl = unPublishResult.Publication.TargetSiteUrl, - TargetWebServerRelativeUrl = unPublishResult.Publication.TargetWebServerRelativeUrl, - TargetLibraryServerRelativeUrl = unPublishResult.Publication.TargetLibraryServerRelativeUrl, - ViewOption = unPublishResult.Publication.ViewOption - } - }); - } - } - } - else - { - LogWarning("The connected site is not a Syntex Content Center site"); - } - } + [Parameter(Mandatory = false, HelpMessage = "Ignored, as this cmdlet no longer performs any request. Kept for backwards compatibility with existing scripts.")] + public PnPConnection Connection = null; } } diff --git a/src/Commands/Utilities/CommandPermissionHelper.cs b/src/Commands/Utilities/CommandPermissionHelper.cs index 0b6cb9112e..3eae05a1a9 100644 --- a/src/Commands/Utilities/CommandPermissionHelper.cs +++ b/src/Commands/Utilities/CommandPermissionHelper.cs @@ -68,7 +68,7 @@ internal static class CommandPermissionHelper "SiteDesign", "SiteScript", "SiteDesignTask", "SiteClassification", "SiteClosure", "SitePolicy", "AuditSetting", "PropertyBagValue", "IndexedPropertyBagKey", "IndexedProperty", "IndexedProperties", "InPlaceRecordsManagement", "RetentionLabel", "DocumentId", "SiteDocumentIdPrefix", "TeamifyPromptHidden", - "SiteCollectionTermStore", "SyntexModel", "SyntexClassifyAndExtract", "VivaConnectionsDashboardACE", + "SiteCollectionTermStore", "VivaConnectionsDashboardACE", "ReIndexWeb", "WebHook", // Tenant wide version trim and cleanup jobs run against the whole site