Sep 21 2023 04:20 AM
Hi All,
I am trying below PowerShell code for applying the retail policy to "Apply label to items in this list or library" but getting some Waring as mentioned below.
This is the ("30 Years Delete (Delete after 30 years)") default Label available for all list and libraris.
Kindly let me know how to Apply label to items in this list or library using PnP PowerShell.
Code:
Connect-PnPOnline -Url $siteURL -UseWebLogin
Set-PnPLabel -List "Documents" -Label "30 Years Delete (Delete after 30 years)" -SyncToItems $true
WARNING: Can not find compliance tag with value: Default. SiteSubscriptionId: 38ae3bcd-9579-4fd4-adda-b42e1495d55a
Sep 21 2023 04:38 AM
Hi @harishpatil,
you are most probably getting the warning messagge because the Set-PnPLabel cmdlet is looking for a compliance tag with the value Default.
However, there is no compliance tag with that value.
To try to resolve this issue, you can use the following PowerShell script to apply the 30 Years Delete (Delete after 30 years) label to all items in the Documents library:
Connect-PnPOnline -Url $siteURL -UseWebLogin
# Get the compliance tag with the value "30 Years Delete (Delete after 30 years)"
$complianceTag = Get-PnPComplianceTag -Label "30 Years Delete (Delete after 30 years)"
# Apply the compliance tag to all items in the "Documents" library
Set-PnPLabel -List "Documents" -Label $complianceTag -SyncToItems $true
This script will first get the compliance tag with the value 30 Years Delete (Delete after 30 years). Then, it will apply the compliance tag to all items in the Documents library.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
Sep 21 2023 04:57 AM
Sep 21 2023 05:02 AM
Hi @harishpatil,
thanks for your Update.
To resolve the issue you are facing, you will need to install the PnP PowerShell cmdlets.
You can install the PnP PowerShell cmdlets using the following steps:
Install-Module -Name SharePointPnPPowerShellOnline -Force
Once the PnP PowerShell cmdlets are installed, you should be able to run the PowerShell script without errors.
Connect-PnPOnline -Url $siteURL -UseWebLogin
# Get the compliance tag with the value "30 Years Delete (Delete after 30 years)"
$complianceTag = Get-PnPComplianceTag -Label "30 Years Delete (Delete after 30 years)"
# Apply the compliance tag to all items in the "Documents" library
Set-PnPLabel -List "Documents" -Label $complianceTag -SyncToItems $true
Please also restart PowerShell after installing the PnP PowerShell cmdlets in order for the changes to take effect.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
Sep 21 2023 06:43 AM - edited Sep 21 2023 06:44 AM
Hi Leon,
I tried to install that module but getting below error. Kindly help me to how resolve the same.
Install-Module -Name SharePointPnPPowerShellOnline -Force
Errors:
PackageManagement\Install-Package : The following commands are already available on this system:'Ensure-PnPFolder,Execute-PnPQuery,Export-PnPClientSidePage,Export-PnPClientSidePageMapping,Ge
t-PnPAvailableClientSideComponents,Get-PnPClientSideComponent,Get-PnPClientSidePage,Get-PnPMicrosoft365GroupMembers,Get-PnPMicrosoft365GroupOwners,Invoke-PnPSearchQuery,Load-PnPProvisioningT
emplate,Move-PnPClientSideComponent,Remove-PnPClientSideComponent,Remove-PnPClientSidePage,Save-PnPClientSidePageConversionLog,Set-PnPClientSidePage,Set-PnPClientSideText,Set-PnPClientSideWe
bPart,Add-PnPAlert,Add-PnPApp,Add-PnPApplicationCustomizer,Add-PnPClientSidePageSection,Add-PnPClientSideText,Add-PnPClientSideWebPart,Add-PnPContentType,Add-PnPContentTypeToDocumentSet,Add-
PnPContentTypeToList,Add-PnPCustomAction,Add-PnPDataRowsToProvisioningTemplate,Add-PnPDocumentSet,Add-PnPEventReceiver,Add-PnPField,Add-PnPFieldFromXml,Add-PnPFieldToContentType,Add-PnPFile,
Add-PnPFileToProvisioningTemplate,Add-PnPFolder,Add-PnPHtmlPublishingPageLayout,Add-PnPHubSiteAssociation,Add-PnPIndexedProperty,Add-PnPJavaScriptBlock,Add-PnPJavaScriptLink,Add-PnPListFolde
rsToProvisioningTemplate,Add-PnPListItem,Add-PnPMasterPage,Add-PnPMicrosoft365GroupMember,Add-PnPMicrosoft365GroupOwner,Add-PnPMicrosoft365GroupToSite,Add-PnPNavigationNode,Add-PnPOrgAssetsL
ibrary,Add-PnPOrgNewsSite,Add-PnPPublishingImageRendition,Add-PnPPublishingPage,Add-PnPPublishingPageLayout,Add-PnPRoleDefinition,Add-PnPSiteClassification,Add-PnPSiteCollectionAdmin,Add-PnP
SiteCollectionAppCatalog,Add-PnPSiteDesign,Add-PnPSiteDesignTask,Add-PnPSiteScript,Add-PnPStoredCredential,Add-PnPTaxonomyField,Add-PnPTeamsChannel,Add-PnPTeamsTab,Add-PnPTeamsTeam,Add-PnPTe
amsUser,Add-PnPTenantCdnOrigin,Add-PnPTenantSequence,Add-PnPTenantSequenceSite,Add-PnPTenantSequenceSubSite,Add-PnPTenantTheme,Add-PnPUserToGroup,Add-PnPView,Add-PnPWebhookSubscription,Add-P
nPWebPartToWebPartPage,Add-PnPWebPartToWikiPage,Add-PnPWikiPage,Add-PnPWorkflowDefinition,Add-PnPWorkflowSubscription,Apply-PnPProvisioningTemplate,Approve-PnPTenantServicePrincipalPermissio
nRequest,Clear-PnPDefaultColumnValues,Clear-PnPListItemAsRecord,Clear-PnPMicrosoft365GroupMember,Clear-PnPMicrosoft365GroupOwner,Clear-PnPRecycleBinItem,Clear-PnPTenantAppCatalogUrl,Clear-Pn
PTenantRecycleBinItem,Connect-PnPOnline,Convert-PnPFolderToProvisioningTemplate,Convert-PnPProvisioningTemplate,Copy-PnPFile,Copy-PnPItemProxy,Deny-PnPTenantServicePrincipalPermissionRequest
,Disable-PnPFeature,Disable-PnPInPlaceRecordsManagementForSite,Disable-PnPPowerShellTelemetry,Disable-PnPResponsiveUI,Disable-PnPSharingForNonOwnersOfSite,Disable-PnPSiteClassification,Disab
le-PnPTenantServicePrincipal,Disconnect-PnPOnline,Enable-PnPCommSite,Enable-PnPFeature,Enable-PnPInPlaceRecordsManagementForSite,Enable-PnPPowerShellTelemetry,Enable-PnPResponsiveUI,Enable-P
nPSiteClassification,Enable-PnPTenantServicePrincipal,Export-PnPListToProvisioningTemplate,Export-PnPTaxonomy,Export-PnPTermGroupToXml,Find-PnPFile,Get-PnPAADUser,Get-PnPAccessToken,Get-PnPA
lert,Get-PnPApp,Get-PnPAppAuthAccessToken,Get-PnPAppInstance,Get-PnPApplicationCustomizer,Get-PnPAuditing,Get-PnPAuthenticationRealm,Get-PnPAvailableLanguage,Get-PnPAzureCertificate,Get-PnPC
onnection,Get-PnPContentType,Get-PnPContentTypePublishingHubUrl,Get-PnPContext,Get-PnPCustomAction,Get-PnPDefaultColumnValues,Get-PnPDeletedMicrosoft365Group,Get-PnPDocumentSetTemplate,Get-P
nPEventReceiver,Get-PnPException,Get-PnPFeature,Get-PnPField,Get-PnPFile,Get-PnPFileVersion,Get-PnPFolder,Get-PnPFolderItem,Get-PnPFooter,Get-PnPGraphAccessToken,Get-PnPGraphSubscription,Get
-PnPGroup,Get-PnPGroupMembers,Get-PnPGroupPermissions,Get-PnPHealthScore,Get-PnPHideDefaultThemes,Get-PnPHomePage,Get-PnPHomeSite,Get-PnPHubSite,Get-PnPHubSiteChild,Get-PnPIndexedPropertyKey
s,Get-PnPInPlaceRecordsManagement,Get-PnPIsSiteAliasAvailable,Get-PnPJavaScriptLink,Get-PnPKnowledgeHubSite,Get-PnPLabel,Get-PnPList,Get-PnPListInformationRightsManagement,Get-PnPListItem,Ge
t-PnPListRecordDeclaration,Get-PnPMasterPage,Get-PnPMicrosoft365Group,Get-PnPNavigationNode,Get-PnPOffice365CurrentServiceStatus,Get-PnPOffice365HistoricalServiceStatus,Get-PnPOffice365Servi
ceMessage,Get-PnPOffice365Services,Get-PnPOrgAssetsLibrary,Get-PnPOrgNewsSite,Get-PnPPowerShellTelemetryEnabled,Get-PnPProperty,Get-PnPPropertyBag,Get-PnPProvisioningTemplate,Get-PnPPublishi
ngImageRendition,Get-PnPRecycleBinItem,Get-PnPRequestAccessEmails,Get-PnPRoleDefinition,Get-PnPSearchConfiguration,Get-PnPSearchCrawlLog,Get-PnPSearchSettings,Get-PnPSharingForNonOwnersOfSit
e,Get-PnPSite,Get-PnPSiteClassification,Get-PnPSiteClosure,Get-PnPSiteCollectionAdmin,Get-PnPSiteCollectionTermStore,Get-PnPSiteDesign,Get-PnPSiteDesignRights,Get-PnPSiteDesignRun,Get-PnPSit
eDesignRunStatus,Get-PnPSiteDesignTask,Get-PnPSitePolicy,Get-PnPSiteScript,Get-PnPSiteScriptFromList,Get-PnPSiteScriptFromWeb,Get-PnPSiteSearchQueryResults,Get-PnPStorageEntity,Get-PnPStored
Credential,Get-PnPSubWebs,Get-PnPTaxonomyItem,Get-PnPTaxonomySession,Get-PnPTeamsApp,Get-PnPTeamsChannel,Get-PnPTeamsChannelMessage,Get-PnPTeamsTab,Get-PnPTeamsTeam,Get-PnPTeamsUser,Get-PnPT
enant,Get-PnPTenantAppCatalogUrl,Get-PnPTenantCdnEnabled,Get-PnPTenantCdnOrigin,Get-PnPTenantCdnPolicies,Get-PnPTenantId,Get-PnPTenantRecycleBinItem,Get-PnPTenantSequence,Get-PnPTenantSequen
ceSite,Get-PnPTenantServicePrincipal,Get-PnPTenantServicePrincipalPermissionGrants,Get-PnPTenantServicePrincipalPermissionRequests,Get-PnPTenantSite,Get-PnPTenantSyncClientRestriction,Get-Pn
PTenantTemplate,Get-PnPTenantTheme,Get-PnPTerm,Get-PnPTermGroup,Get-PnPTermSet,Get-PnPTheme,Get-PnPTimeZoneId,Get-PnPUnifiedAuditLog,Get-PnPUPABulkImportStatus,Get-PnPUser,Get-PnPUserOneDriv
eQuota,Get-PnPUserProfileProperty,Get-PnPView,Get-PnPWeb,Get-PnPWebhookSubscriptions,Get-PnPWebPart,Get-PnPWebPartProperty,Get-PnPWebPartXml,Get-PnPWebTemplates,Get-PnPWikiPageContent,Get-Pn
PWorkflowDefinition,Get-PnPWorkflowInstance,Get-PnPWorkflowSubscription,Grant-PnPHubSiteRights,Grant-PnPSiteDesignRights,Grant-PnPTenantServicePrincipalPermission,Import-PnPAppPackage,Import
-PnPTaxonomy,Import-PnPTermGroupFromXml,Import-PnPTermSet,Install-PnPApp,Install-PnPSolution,Invoke-PnPQuery,Invoke-PnPSiteDesign,Invoke-PnPSPRestMethod,Invoke-PnPWebAction,Measure-PnPList,M
easure-PnPResponseTime,Measure-PnPWeb,Move-PnPFile,Move-PnPFolder,Move-PnPItemProxy,Move-PnPListItemToRecycleBin,Move-PnPRecycleBinItem,New-PnPAzureCertificate,New-PnPExtensibilityHandlerObj
ect,New-PnPGraphSubscription,New-PnPGroup,New-PnPList,New-PnPMicrosoft365Group,New-PnPPersonalSite,New-PnPProvisioningTemplate,New-PnPProvisioningTemplateFromFolder,New-PnPSite,New-PnPTeamsA
pp,New-PnPTeamsTeam,New-PnPTenantSequence,New-PnPTenantSequenceCommunicationSite,New-PnPTenantSequenceTeamNoGroupSite,New-PnPTenantSequenceTeamNoGroupSubSite,New-PnPTenantSequenceTeamSite,Ne
w-PnPTenantSite,New-PnPTenantTemplate,New-PnPTerm,New-PnPTermGroup,New-PnPTermLabel,New-PnPTermSet,New-PnPUPABulkImportJob,New-PnPUser,New-PnPWeb,Publish-PnPApp,Read-PnPProvisioningTemplate,
Read-PnPTenantTemplate,Register-PnPAppCatalogSite,Register-PnPHubSite,Register-PnPManagementShellAccess,Remove-PnPAlert,Remove-PnPApp,Remove-PnPApplicationCustomizer,Remove-PnPContentType,Re
move-PnPContentTypeFromDocumentSet,Remove-PnPContentTypeFromList,Remove-PnPCustomAction,Remove-PnPDeletedMicrosoft365Group,Remove-PnPEventReceiver,Remove-PnPField,Remove-PnPFieldFromContentT
ype,Remove-PnPFile,Remove-PnPFileFromProvisioningTemplate,Remove-PnPFileVersion,Remove-PnPFolder,Remove-PnPGraphSubscription,Remove-PnPGroup,Remove-PnPHomeSite,Remove-PnPHubSiteAssociation,R
emove-PnPIndexedProperty,Remove-PnPJavaScriptLink,Remove-PnPKnowledgeHubSite,Remove-PnPList,Remove-PnPListItem,Remove-PnPMicrosoft365Group,Remove-PnPMicrosoft365GroupMember,Remove-PnPMicroso
ft365GroupOwner,Remove-PnPNavigationNode,Remove-PnPOrgAssetsLibrary,Remove-PnPOrgNewsSite,Remove-PnPPropertyBagValue,Remove-PnPPublishingImageRendition,Remove-PnPRoleDefinition,Remove-PnPSea
rchConfiguration,Remove-PnPSiteClassification,Remove-PnPSiteCollectionAdmin,Remove-PnPSiteCollectionAppCatalog,Remove-PnPSiteDesign,Remove-PnPSiteDesignTask,Remove-PnPSiteScript,Remove-PnPSt
orageEntity,Remove-PnPStoredCredential,Remove-PnPTaxonomyItem,Remove-PnPTeamsApp,Remove-PnPTeamsChannel,Remove-PnPTeamsTab,Remove-PnPTeamsTeam,Remove-PnPTeamsUser,Remove-PnPTenantCdnOrigin,R
emove-PnPTenantSite,Remove-PnPTenantTheme,Remove-PnPTermGroup,Remove-PnPUser,Remove-PnPUserFromGroup,Remove-PnPView,Remove-PnPWeb,Remove-PnPWebhookSubscription,Remove-PnPWebPart,Remove-PnPWi
kiPage,Remove-PnPWorkflowDefinition,Remove-PnPWorkflowSubscription,Rename-PnPFile,Rename-PnPFolder,Request-PnPAccessToken,Request-PnPReIndexList,Request-PnPReIndexWeb,Reset-PnPFileVersion,Re
set-PnPLabel,Reset-PnPMicrosoft365GroupExpiration,Reset-PnPUserOneDriveQuotaToDefault,Resolve-PnPFolder,Restore-PnPDeletedMicrosoft365Group,Restore-PnPFileVersion,Restore-PnPRecycleBinItem,R
estore-PnPTenantRecycleBinItem,Resume-PnPWorkflowInstance,Revoke-PnPHubSiteRights,Revoke-PnPSiteDesignRights,Revoke-PnPTenantServicePrincipalPermission,Save-PnPProvisioningTemplate,Save-PnPT
enantTemplate,Send-PnPMail,Set-PnPApplicationCustomizer,Set-PnPAppSideLoading,Set-PnPAuditing,Set-PnPAvailablePageLayouts,Set-PnPContext,Set-PnPDefaultColumnValues,Set-PnPDefaultContentTypeT
oList,Set-PnPDefaultPageLayout,Set-PnPDocumentSetField,Set-PnPField,Set-PnPFileCheckedIn,Set-PnPFileCheckedOut,Set-PnPFolderPermission,Set-PnPFooter,Set-PnPGraphSubscription,Set-PnPGroup,Set
-PnPGroupPermissions,Set-PnPHideDefaultThemes,Set-PnPHomePage,Set-PnPHomeSite,Set-PnPHubSite,Set-PnPIndexedProperties,Set-PnPInPlaceRecordsManagement,Set-PnPKnowledgeHubSite,Set-PnPLabel,Set
-PnPList,Set-PnPListInformationRightsManagement,Set-PnPListItem,Set-PnPListItemAsRecord,Set-PnPListItemPermission,Set-PnPListPermission,Set-PnPListRecordDeclaration,Set-PnPMasterPage,Set-PnP
Microsoft365Group,Set-PnPMinimalDownloadStrategy,Set-PnPPropertyBagValue,Set-PnPProvisioningTemplateMetadata,Set-PnPRequestAccessEmails,Set-PnPSearchConfiguration,Set-PnPSearchSettings,Set-P
nPSite,Set-PnPSiteClosure,Set-PnPSiteDesign,Set-PnPSitePolicy,Set-PnPSiteScript,Set-PnPStorageEntity,Set-PnPTaxonomyFieldValue,Set-PnPTeamifyPromptHidden,Set-PnPTeamsChannel,Set-PnPTeamsTab,
Set-PnPTeamsTeam,Set-PnPTeamsTeamArchivedState,Set-PnPTeamsTeamPicture,Set-PnPTenant,Set-PnPTenantAppCatalogUrl,Set-PnPTenantCdnEnabled,Set-PnPTenantCdnPolicy,Set-PnPTenantSite,Set-PnPTenant
SyncClientRestriction,Set-PnPTermGroup,Set-PnPTermSet,Set-PnPTheme,Set-PnPTraceLog,Set-PnPUserOneDriveQuota,Set-PnPUserProfileProperty,Set-PnPView,Set-PnPWeb,Set-PnPWebhookSubscription,Set-P
nPWebPartProperty,Set-PnPWebPermission,Set-PnPWebTheme,Set-PnPWikiPageContent,Start-PnPWorkflowInstance,Stop-PnPWorkflowInstance,Submit-PnPSearchQuery,Submit-PnPTeamsChannelMessage,Sync-PnPA
ppToTeams,Test-PnPListItemIsRecord,Test-PnPTenantTemplate,Uninstall-PnPApp,Uninstall-PnPAppInstance,Uninstall-PnPSolution,Unpublish-PnPApp,Unregister-PnPHubSite,Update-PnPApp,Update-PnPSiteC
lassification,Update-PnPTeamsApp'. This module 'SharePointPnPPowerShellOnline' may override the existing commands. If you still want to install this module 'SharePointPnPPowerShellOnline',
use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Sep 21 2023 06:51 AM - edited Sep 21 2023 06:54 AM
Hi Leon,
I tried to install that module but getting below error. Kindly help me how to resolve the same.
Install-Module -Name SharePointPnPPowerShellOnline -Force
Errors:
PackageManagement\Install-Package : The following commands are already available on this system:'Ensure-PnPFolder,Execute-PnPQuery,Export-PnPClientSidePage,Export-PnPClientSidePageMapping,Ge
t-PnPAvailableClientSideComponents,Get-PnPClientSideComponent,Get-PnPClientSidePage,Get-PnPMicrosoft365GroupMembers,Get-PnPMicrosoft365GroupOwners,Invoke-PnPSearchQuery,Load-PnPProvisioningT
emplate,Move-PnPClientSideComponent,Remove-PnPClientSideComponent,Remove-PnPClientSidePage,Save-PnPClientSidePageConversionLog,Set-PnPClientSidePage,Set-PnPClientSideText,Set-PnPClientSideWe
bPart,Add-PnPAlert,Add-PnPApp,Add-PnPApplicationCustomizer,Add-PnPClientSidePageSection,Add-PnPClientSideText,Add-PnPClientSideWebPart,Add-PnPContentType,Add-PnPContentTypeToDocumentSet,Add-
PnPContentTypeToList,Add-PnPCustomAction,Add-PnPDataRowsToProvisioningTemplate,Add-PnPDocumentSet,Add-PnPEventReceiver,Add-PnPField,Add-PnPFieldFromXml,Add-PnPFieldToContentType,Add-PnPFile,
Add-PnPFileToProvisioningTemplate,Add-PnPFolder,Add-PnPHtmlPublishingPageLayout,Add-PnPHubSiteAssociation,Add-PnPIndexedProperty,Add-PnPJavaScriptBlock,Add-PnPJavaScriptLink,Add-PnPListFolde
rsToProvisioningTemplate,Add-PnPListItem,Add-PnPMasterPage,Add-PnPMicrosoft365GroupMember,Add-PnPMicrosoft365GroupOwner,Add-PnPMicrosoft365GroupToSite,Add-PnPNavigationNode,Add-PnPOrgAssetsL
ibrary,Add-PnPOrgNewsSite,Add-PnPPublishingImageRendition,Add-PnPPublishingPage,Add-PnPPublishingPageLayout,Add-PnPRoleDefinition,Add-PnPSiteClassification,Add-PnPSiteCollectionAdmin,Add-PnP
SiteCollectionAppCatalog,Add-PnPSiteDesign,Add-PnPSiteDesignTask,Add-PnPSiteScript,Add-PnPStoredCredential,Add-PnPTaxonomyField,Add-PnPTeamsChannel,Add-PnPTeamsTab,Add-PnPTeamsTeam,Add-PnPTe
amsUser,Add-PnPTenantCdnOrigin,Add-PnPTenantSequence,Add-PnPTenantSequenceSite,Add-PnPTenantSequenceSubSite,Add-PnPTenantTheme,Add-PnPUserToGroup,Add-PnPView,Add-PnPWebhookSubscription,Add-P
nPWebPartToWebPartPage,Add-PnPWebPartToWikiPage,Add-PnPWikiPage,Add-PnPWorkflowDefinition,Add-PnPWorkflowSubscription,Apply-PnPProvisioningTemplate,Approve-PnPTenantServicePrincipalPermissio
nRequest,Clear-PnPDefaultColumnValues,Clear-PnPListItemAsRecord,Clear-PnPMicrosoft365GroupMember,Clear-PnPMicrosoft365GroupOwner,Clear-PnPRecycleBinItem,Clear-PnPTenantAppCatalogUrl,Clear-Pn
PTenantRecycleBinItem,Connect-PnPOnline,Convert-PnPFolderToProvisioningTemplate,Convert-PnPProvisioningTemplate,Copy-PnPFile,Copy-PnPItemProxy,Deny-PnPTenantServicePrincipalPermissionRequest
,Disable-PnPFeature,Disable-PnPInPlaceRecordsManagementForSite,Disable-PnPPowerShellTelemetry,Disable-PnPResponsiveUI,Disable-PnPSharingForNonOwnersOfSite,Disable-PnPSiteClassification,Disab
le-PnPTenantServicePrincipal,Disconnect-PnPOnline,Enable-PnPCommSite,Enable-PnPFeature,Enable-PnPInPlaceRecordsManagementForSite,Enable-PnPPowerShellTelemetry,Enable-PnPResponsiveUI,Enable-P
nPSiteClassification,Enable-PnPTenantServicePrincipal,Export-PnPListToProvisioningTemplate,Export-PnPTaxonomy,Export-PnPTermGroupToXml,Find-PnPFile,Get-PnPAADUser,Get-PnPAccessToken,Get-PnPA
lert,Get-PnPApp,Get-PnPAppAuthAccessToken,Get-PnPAppInstance,Get-PnPApplicationCustomizer,Get-PnPAuditing,Get-PnPAuthenticationRealm,Get-PnPAvailableLanguage,Get-PnPAzureCertificate,Get-PnPC
onnection,Get-PnPContentType,Get-PnPContentTypePublishingHubUrl,Get-PnPContext,Get-PnPCustomAction,Get-PnPDefaultColumnValues,Get-PnPDeletedMicrosoft365Group,Get-PnPDocumentSetTemplate,Get-P
nPEventReceiver,Get-PnPException,Get-PnPFeature,Get-PnPField,Get-PnPFile,Get-PnPFileVersion,Get-PnPFolder,Get-PnPFolderItem,Get-PnPFooter,Get-PnPGraphAccessToken,Get-PnPGraphSubscription,Get
-PnPGroup,Get-PnPGroupMembers,Get-PnPGroupPermissions,Get-PnPHealthScore,Get-PnPHideDefaultThemes,Get-PnPHomePage,Get-PnPHomeSite,Get-PnPHubSite,Get-PnPHubSiteChild,Get-PnPIndexedPropertyKey
s,Get-PnPInPlaceRecordsManagement,Get-PnPIsSiteAliasAvailable,Get-PnPJavaScriptLink,Get-PnPKnowledgeHubSite,Get-PnPLabel,Get-PnPList,Get-PnPListInformationRightsManagement,Get-PnPListItem,Ge
t-PnPListRecordDeclaration,Get-PnPMasterPage,Get-PnPMicrosoft365Group,Get-PnPNavigationNode,Get-PnPOffice365CurrentServiceStatus,Get-PnPOffice365HistoricalServiceStatus,Get-PnPOffice365Servi
ceMessage,Get-PnPOffice365Services,Get-PnPOrgAssetsLibrary,Get-PnPOrgNewsSite,Get-PnPPowerShellTelemetryEnabled,Get-PnPProperty,Get-PnPPropertyBag,Get-PnPProvisioningTemplate,Get-PnPPublishi
ngImageRendition,Get-PnPRecycleBinItem,Get-PnPRequestAccessEmails,Get-PnPRoleDefinition,Get-PnPSearchConfiguration,Get-PnPSearchCrawlLog,Get-PnPSearchSettings,Get-PnPSharingForNonOwnersOfSit
e,Get-PnPSite,Get-PnPSiteClassification,Get-PnPSiteClosure,Get-PnPSiteCollectionAdmin,Get-PnPSiteCollectionTermStore,Get-PnPSiteDesign,Get-PnPSiteDesignRights,Get-PnPSiteDesignRun,Get-PnPSit
eDesignRunStatus,Get-PnPSiteDesignTask,Get-PnPSitePolicy,Get-PnPSiteScript,Get-PnPSiteScriptFromList,Get-PnPSiteScriptFromWeb,Get-PnPSiteSearchQueryResults,Get-PnPStorageEntity,Get-PnPStored
Credential,Get-PnPSubWebs,Get-PnPTaxonomyItem,Get-PnPTaxonomySession,Get-PnPTeamsApp,Get-PnPTeamsChannel,Get-PnPTeamsChannelMessage,Get-PnPTeamsTab,Get-PnPTeamsTeam,Get-PnPTeamsUser,Get-PnPT
enant,Get-PnPTenantAppCatalogUrl,Get-PnPTenantCdnEnabled,Get-PnPTenantCdnOrigin,Get-PnPTenantCdnPolicies,Get-PnPTenantId,Get-PnPTenantRecycleBinItem,Get-PnPTenantSequence,Get-PnPTenantSequen
ceSite,Get-PnPTenantServicePrincipal,Get-PnPTenantServicePrincipalPermissionGrants,Get-PnPTenantServicePrincipalPermissionRequests,Get-PnPTenantSite,Get-PnPTenantSyncClientRestriction,Get-Pn
PTenantTemplate,Get-PnPTenantTheme,Get-PnPTerm,Get-PnPTermGroup,Get-PnPTermSet,Get-PnPTheme,Get-PnPTimeZoneId,Get-PnPUnifiedAuditLog,Get-PnPUPABulkImportStatus,Get-PnPUser,Get-PnPUserOneDriv
eQuota,Get-PnPUserProfileProperty,Get-PnPView,Get-PnPWeb,Get-PnPWebhookSubscriptions,Get-PnPWebPart,Get-PnPWebPartProperty,Get-PnPWebPartXml,Get-PnPWebTemplates,Get-PnPWikiPageContent,Get-Pn
PWorkflowDefinition,Get-PnPWorkflowInstance,Get-PnPWorkflowSubscription,Grant-PnPHubSiteRights,Grant-PnPSiteDesignRights,Grant-PnPTenantServicePrincipalPermission,Import-PnPAppPackage,Import
-PnPTaxonomy,Import-PnPTermGroupFromXml,Import-PnPTermSet,Install-PnPApp,Install-PnPSolution,Invoke-PnPQuery,Invoke-PnPSiteDesign,Invoke-PnPSPRestMethod,Invoke-PnPWebAction,Measure-PnPList,M
easure-PnPResponseTime,Measure-PnPWeb,Move-PnPFile,Move-PnPFolder,Move-PnPItemProxy,Move-PnPListItemToRecycleBin,Move-PnPRecycleBinItem,New-PnPAzureCertificate,New-PnPExtensibilityHandlerObj
ect,New-PnPGraphSubscription,New-PnPGroup,New-PnPList,New-PnPMicrosoft365Group,New-PnPPersonalSite,New-PnPProvisioningTemplate,New-PnPProvisioningTemplateFromFolder,New-PnPSite,New-PnPTeamsA
pp,New-PnPTeamsTeam,New-PnPTenantSequence,New-PnPTenantSequenceCommunicationSite,New-PnPTenantSequenceTeamNoGroupSite,New-PnPTenantSequenceTeamNoGroupSubSite,New-PnPTenantSequenceTeamSite,Ne
w-PnPTenantSite,New-PnPTenantTemplate,New-PnPTerm,New-PnPTermGroup,New-PnPTermLabel,New-PnPTermSet,New-PnPUPABulkImportJob,New-PnPUser,New-PnPWeb,Publish-PnPApp,Read-PnPProvisioningTemplate,
Read-PnPTenantTemplate,Register-PnPAppCatalogSite,Register-PnPHubSite,Register-PnPManagementShellAccess,Remove-PnPAlert,Remove-PnPApp,Remove-PnPApplicationCustomizer,Remove-PnPContentType,Re
move-PnPContentTypeFromDocumentSet,Remove-PnPContentTypeFromList,Remove-PnPCustomAction,Remove-PnPDeletedMicrosoft365Group,Remove-PnPEventReceiver,Remove-PnPField,Remove-PnPFieldFromContentT
ype,Remove-PnPFile,Remove-PnPFileFromProvisioningTemplate,Remove-PnPFileVersion,Remove-PnPFolder,Remove-PnPGraphSubscription,Remove-PnPGroup,Remove-PnPHomeSite,Remove-PnPHubSiteAssociation,R
emove-PnPIndexedProperty,Remove-PnPJavaScriptLink,Remove-PnPKnowledgeHubSite,Remove-PnPList,Remove-PnPListItem,Remove-PnPMicrosoft365Group,Remove-PnPMicrosoft365GroupMember,Remove-PnPMicroso
ft365GroupOwner,Remove-PnPNavigationNode,Remove-PnPOrgAssetsLibrary,Remove-PnPOrgNewsSite,Remove-PnPPropertyBagValue,Remove-PnPPublishingImageRendition,Remove-PnPRoleDefinition,Remove-PnPSea
rchConfiguration,Remove-PnPSiteClassification,Remove-PnPSiteCollectionAdmin,Remove-PnPSiteCollectionAppCatalog,Remove-PnPSiteDesign,Remove-PnPSiteDesignTask,Remove-PnPSiteScript,Remove-PnPSt
orageEntity,Remove-PnPStoredCredential,Remove-PnPTaxonomyItem,Remove-PnPTeamsApp,Remove-PnPTeamsChannel,Remove-PnPTeamsTab,Remove-PnPTeamsTeam,Remove-PnPTeamsUser,Remove-PnPTenantCdnOrigin,R
emove-PnPTenantSite,Remove-PnPTenantTheme,Remove-PnPTermGroup,Remove-PnPUser,Remove-PnPUserFromGroup,Remove-PnPView,Remove-PnPWeb,Remove-PnPWebhookSubscription,Remove-PnPWebPart,Remove-PnPWi
kiPage,Remove-PnPWorkflowDefinition,Remove-PnPWorkflowSubscription,Rename-PnPFile,Rename-PnPFolder,Request-PnPAccessToken,Request-PnPReIndexList,Request-PnPReIndexWeb,Reset-PnPFileVersion,Re
set-PnPLabel,Reset-PnPMicrosoft365GroupExpiration,Reset-PnPUserOneDriveQuotaToDefault,Resolve-PnPFolder,Restore-PnPDeletedMicrosoft365Group,Restore-PnPFileVersion,Restore-PnPRecycleBinItem,R
estore-PnPTenantRecycleBinItem,Resume-PnPWorkflowInstance,Revoke-PnPHubSiteRights,Revoke-PnPSiteDesignRights,Revoke-PnPTenantServicePrincipalPermission,Save-PnPProvisioningTemplate,Save-PnPT
enantTemplate,Send-PnPMail,Set-PnPApplicationCustomizer,Set-PnPAppSideLoading,Set-PnPAuditing,Set-PnPAvailablePageLayouts,Set-PnPContext,Set-PnPDefaultColumnValues,Set-PnPDefaultContentTypeT
oList,Set-PnPDefaultPageLayout,Set-PnPDocumentSetField,Set-PnPField,Set-PnPFileCheckedIn,Set-PnPFileCheckedOut,Set-PnPFolderPermission,Set-PnPFooter,Set-PnPGraphSubscription,Set-PnPGroup,Set
-PnPGroupPermissions,Set-PnPHideDefaultThemes,Set-PnPHomePage,Set-PnPHomeSite,Set-PnPHubSite,Set-PnPIndexedProperties,Set-PnPInPlaceRecordsManagement,Set-PnPKnowledgeHubSite,Set-PnPLabel,Set
-PnPList,Set-PnPListInformationRightsManagement,Set-PnPListItem,Set-PnPListItemAsRecord,Set-PnPListItemPermission,Set-PnPListPermission,Set-PnPListRecordDeclaration,Set-PnPMasterPage,Set-PnP
Microsoft365Group,Set-PnPMinimalDownloadStrategy,Set-PnPPropertyBagValue,Set-PnPProvisioningTemplateMetadata,Set-PnPRequestAccessEmails,Set-PnPSearchConfiguration,Set-PnPSearchSettings,Set-P
nPSite,Set-PnPSiteClosure,Set-PnPSiteDesign,Set-PnPSitePolicy,Set-PnPSiteScript,Set-PnPStorageEntity,Set-PnPTaxonomyFieldValue,Set-PnPTeamifyPromptHidden,Set-PnPTeamsChannel,Set-PnPTeamsTab,
Set-PnPTeamsTeam,Set-PnPTeamsTeamArchivedState,Set-PnPTeamsTeamPicture,Set-PnPTenant,Set-PnPTenantAppCatalogUrl,Set-PnPTenantCdnEnabled,Set-PnPTenantCdnPolicy,Set-PnPTenantSite,Set-PnPTenant
SyncClientRestriction,Set-PnPTermGroup,Set-PnPTermSet,Set-PnPTheme,Set-PnPTraceLog,Set-PnPUserOneDriveQuota,Set-PnPUserProfileProperty,Set-PnPView,Set-PnPWeb,Set-PnPWebhookSubscription,Set-P
nPWebPartProperty,Set-PnPWebPermission,Set-PnPWebTheme,Set-PnPWikiPageContent,Start-PnPWorkflowInstance,Stop-PnPWorkflowInstance,Submit-PnPSearchQuery,Submit-PnPTeamsChannelMessage,Sync-PnPA
ppToTeams,Test-PnPListItemIsRecord,Test-PnPTenantTemplate,Uninstall-PnPApp,Uninstall-PnPAppInstance,Uninstall-PnPSolution,Unpublish-PnPApp,Unregister-PnPHubSite,Update-PnPApp,Update-PnPSiteC
lassification,Update-PnPTeamsApp'. This module 'SharePointPnPPowerShellOnline' may override the existing commands. If you still want to install this module 'SharePointPnPPowerShellOnline',
use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Sep 21 2023 06:58 AM
Hi @harishpatil,
It appears that some of the commands in this module might already exist in your PowerShell environment, causing a conflict.
To resolve this, you can try installing the module with the -AllowClobber parameter. This parameter allows the module to override existing commands with the same names, potentially resolving conflicts. Here's how you can do it:
Install-Module -Name SharePointPnPPowerShellOnline -Force -AllowClobber
Adding the -AllowClobber parameter should help you install the module without conflicts. After that, you can proceed with the rest of the PowerShell script as previously provided.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
Sep 21 2023 07:19 AM - edited Sep 21 2023 07:56 AM
Hi Leon,
I have installed the mentioned module without any errors. It was showing installing Complete and it cam back on command prompt. Again I tried to run our script but still getting same below error.
Do I need to install any other things?
Error:
Get-PnPComplianceTag : The term 'Get-PnPComplianceTag' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At C:\OnlineMigration\Suresh\001-Comparison\Apply_Label_Retain_Policies.ps1:6 char:18
+ $complianceTag = Get-PnPComplianceTag -Label "30 Years Delete (Delete ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PnPComplianceTag:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Set-PnPLabel : Cannot bind argument to parameter 'Label' because it is null.
At C:\OnlineMigration\Suresh\001-Comparison\Apply_Label_Retain_Policies.ps1:9 char:39
+ Set-PnPLabel -List "Documents" -Label $complianceTag -SyncToItems $tr ...
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-PnPLabel], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,PnP.PowerShell.Commands.InformationManagement.SetLabel
Sep 21 2023 10:20 PM
Sep 21 2023 11:06 PM
Hi @harishpatil,
The Get-PnPComplianceTag cmdlet is a new cmdlet that was introduced in PnP PowerShell version 3.29.2101.0. If you are using an older version of PnP PowerShell, then you will not have this cmdlet and you will need to upgrade to a newer version.
To check the version of PnP PowerShell that you are using, run the following command:
Get-Module SharePointPnPPowerShellOnline -ListAvailable | Select-Object Version
If you are not using PnP PowerShell version 3.29.2101.0 or higher, then you can upgrade to the latest version by running the following command:
Install-Module SharePointPnPPowerShellOnline -Force
Once you have upgraded to the latest version of PnP PowerShell, you should be able to run the Get-PnPComplianceTag cmdlet without any errors.
If you are still having problems, please try the following:
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
Sep 22 2023 06:53 AM
Apr 22 2024 02:40 PM