6

You need to use /_api/groupsitemanager/HideTeamifyPrompt method to disable the Teamify banner. You can use it in PnP PowerShell as below: Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/TestTeamSite" $jsonBody = "{'siteUrl':'https://tenant.sharepoint.com/sites/TestTeamSite'}" Invoke-PnPSPRestMethod -Method Post -Url "/_api/groupsitemanager/...


4

You could use a CAML query to select your files. This example will get the last 5 modified files. Note that RowLimit won't work as expected, hence the select -first 5 at the end $listname = "Documents" $query = "<View><Query><OrderBy><FieldRef Ascending='False' Name='Modified'/></OrderBy></Query></View>" $items = ...


3

This can be done via PowerShell: $tenant = "https://tenant-admin.sharepoint.com" $web = "https://tenant.sharepoint.com/sites/ModernTeam" Connect-PnPOnline -Url $tenant -SPOManagementShell $site = Get-PnPTenantSite -Detailed -Url $web if ($site.DenyAddAndCustomizePages -ne 'Disabled') { $site.DenyAddAndCustomizePages = 'Disabled' $site.Update() $...


3

We can download the file from SharePoint online using the below PowerShell code - this code will download load all files from the given SharePoint online library within the given date ranges, however if you want to do the specific file inside the for each loop you need to add an if condition for the file you want to download. #Load SharePoint CSOM ...


3

You can use the below PowerShell code: $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials $ctx.Credentials = $Credentials; $web = $ctx.Web $ctx.Load($web); $ctx.ExecuteQuery(); Note : The logged in user must have appropriate permissions to SharePoint to do the task....


2

Update the PowerShell script as below. $fieldTitle = "ProjectNumber" $customfield = $Context.Site.RootWeb.Fields.GetByInternalNameOrTitle($fieldTitle) $customfield.SetShowInEditForm($true) $Context.ExecuteQuery() $customfield.SetShowInNewForm($false) $Context.ExecuteQuery() $customfield.UpdateAndPushChanges($true) $Context.ExecuteQuery()


2

For an on-prem farm, it won't be possible to 'retire' the use of the SharePoint snapin due to functions that are simply not available via CSOM to manage a farm. I think it is a great idea to learn the PnP module and CSOM as it will provide you a better understanding of the capabilities available in SPO should you migrate, but I wouldn't put a lot of effort ...


2

We can modify the options of a choice field by modifying the schema xml of the field Let say the field Fruit has 2 options, Apple and Orange and we want to add Banana to the list First we get the schema xml of the field $field = Get-PnPField -List 20559154-6a7e-4e67-b10b-a12bbc943152 -Identity Fruit [xml]$schemaXml = $field.SchemaXml The schema xml of ...


2

You need to use the CreateLabel method to add other labels. Its not directly available via PnP, so you need to write some more commands to add these labels. The code necessary for that is as below: $context = Get-PnPContext $term = New-PnPTerm -Name "7230" -TermSet "Kreditorer" -TermGroup "Kreditorer" -LCID "1033" $createLabel1 = $term.CreateLabel("...


2

In case you just want to use pnp-powershell, All you need to do for each one of those folders / files: FILE $result = Get-PnPProperty -ClientObject $file -Property RoleAssignments Get-PnPProperty -ClientObject $file.RoleAssignments -Property Groups foreach ($role in $file.RoleAssignments) { $result = Get-PnPProperty -...


2

I was able to figure this out by using the $context.Load($thing); $context.ExecuteQuery() # Setup the site context [Microsoft.SharePoint.Client.Web] $Connection = Get-PnPWeb $context = $Connection.Context [Microsoft.SharePoint.Client.List] $list = Get-PnPList $listName # Load the list $context.Load($list) $context.ExecuteQuery() # Load the checked out ...


2

I would add the web part as custom using the ID, for example: Add-PnPClientSideWebPart -Page $homePage -Component "b519c4f1-5cf7-4586-a678-2f1c62cc175a" -Section 1 -Column 1 You can find the ID by adding the part to the page and inspecting the element in dev tools. Search for data-sp-feature-instance-id.


2

Unfortunately the modules are often not cross-version compatible due to the different CSOM versions supported between the products. this is what your problem looks like, read this blog how to run it side by side: Using SharePoint PnP PowerShell Modules Side-by-Side (2013, 2016, & Online)


2

I have seem to of fixed the script by putting every cmdlet into a variable. Like so: # CREATE NEW LIST $fix1 = New-PnPList ` -Title 'Honours' ` -Template GenericList ` -Url lists/honours # ADD NEW FIELD TO LIST $fix2 = Add-PnPField ` -List 'Honours' ` -DisplayName 'Honours' ` -InternalName 'Honours' ` -Type Choice ` -Group 'Football ...


2

In my test, it working fine. You can go to Site Settings->Site Columns and check this column. My test script as below. $URL='https://tenant.sharepoint.com/sites/team' Connect-PnPOnline –Url $URL –Credentials (Get-Credential) $fix11 = Add-PnPField ` -DisplayName 'Date of Birth' ` -InternalName DateofBirth ` -Type Date ` -Required ` -Group '...


2

You can use the Get-PnPTenantSite command to check if a site collection exists or not as below: $site = "" Try { Write-Host "Checking, if site already exists..." $site = Get-PnPTenantSite -Url "<your-site-url>" -ErrorAction SilentlyContinue } Catch { } if ($site -ne $null) { Write-Host "Site already exists, use existing..." } else { ...


2

I am able to reproduce the issue and I tried different approaches as well but not able to delete the column. As a workaround, you can hide the Title column. Below is the script for the same. it will first make the Title column not required and then hide it. Connect-PnPOnline https://contos.com/sites/Test $context = Get-PnPContext $web = $context.web $list =...


2

The below PowerShell command retrieves all the SharePoint Groups from the SharePoint site and its users with users count for the group. Get-PnPGroup PnP PowerShell cmdlet gets the SharePoint Groups from the SharePoint site collection. PS:> $cred = Get-Credential PS:> Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/dev -Credential ...


2

You can refer to the powershell in the article below: To change access request Emails of all sites in a site collection or tenant: SharePoint Online: PowerShell to Change Access Request Email for All Sites To disable access request, simply clear the Email value. Please note: Microsoft provides third-party contact information to help you find technical ...


2

To download a specific file, use the following syntax: Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/somesite Get-PnPFile -Url "/sites/somesite/SitePages/Home.aspx" -AsFile The parameter -AsFile makes the command save the file to your current directory. To upload the same file to another site collection, you would use the following: Connect-...


2

Okay, so the List object exposed by CSOM and Pnp-PowerShell does not Directly contain the same Author property that the server-side object contains -- However, this value Is still in the underlying XML schema of the list. The schema is not returned by default when you call get-pnpList, but it can be included with the Includes, parameter, and then it is just ...


2

There is no ready-made PowerShell script for your requirement. But, I will help you to build this script on your own. Get DefaultLinkType property of a SharePoint site: If you want to get the DefaultLinkType property of a SharePoint site then you can use: $site = Get-SPOSite -Identity https://spexplorer.sharepoint.com/sites/SPConnect -Detailed $site....


2

This will not modify the site at all, it will just export the template No data will be included You must first create a new site (or modify an existing one). You do that by using the command Apply-PnPProvisioningTemplate -Path template.pnp. More details here This will use the current folder, but you can specify where you want it: Get-PnPProvisioningTemplate -...


2

You could use use New-SPOSite to create new SharePoint modern communication sites with timezone: New-SPOSite -Url https://acme.sharepoint.com/sites/my_site -Owner me@acme.com -Template "SITEPAGEPUBLISHING#0" -StorageQuota 2048 -Title "Communication" -TimeZoneId 13 -LocaleID 1044 References: https://www.sharepointdiary.com/2016/06/sharepoint-online-create-...


2

You can use the below PnP PowerShell code: Connect-PnPOnline -Url <url> $ListItems = Get-PnPListItem -List <MyDocLibrary> $ctx= Get-PnPContext foreach ($item in $ListItems) { $file = $item.file $ctx.load($file) $ctx.ExecuteQuery() Write-Host $file.Name,$file.UIVersionLabel } Source of the above code: How Do I ...


2

You must use the -like operator, not -contains : $subwebs= Get-PnPSubWebs -Recurse | where {$_.Title -like "*friday*" } Contains is used to check if a specific member is part of an array, thus it will only return exact matches to the string. For example: ❯ $test = @("Friday", "Fridays are the best.", "Yay friday!", "Saturdays are great also.") ...


2

In PowerShell, never use -contains. Instead, use -match. If you make this change your script will work perfectly fine: $varURL = Read-Host -Prompt 'Provide URL to site' Connect-PnPOnline -Url $varURL -UseWebLogin Function Get-Subsites() { $subwebs= Get-PnPSubWebs -Recurse | where {$_.Title -match "FRIDAY" } foreach ($Subweb in $subwebs) { ...


2

Try adding -FieldOptions AddToAllContentTypes parameter to your Add-PnPField command. For Example: Add-PnPField -List "New list" -DisplayName "New List Column" -InternalName "NewListColumn" -Type Text -Required -AddToDefaultView -FieldOptions AddToAllContentTypes Source: Add-PnPField: Create List Column in SharePoint using PowerShell Note: As per the ...


1

Currently, Add-PnPField command still not support "LookupList" parameter, please refer the opening issue here: Question: Adding a lookup field with Add-PnPField #1518 A workaround is to add the field with schema like this: $xml = '<Field Type="Lookup" DisplayName="testlookup" Required="FALSE" EnforceUniqueValues="FALSE" List="{2cefea32-3396-4a9f-9117-...


1

Currently Add-PnPField doesn not support parameterized creation of Lookup columns. You can use the below code (tried and tested). $URL = "https://testing.sharepoint.com/sites/sitename" Connect-PnPOnline -url $URL -Credential credentialname $targetlistname = "users" ## Name of the target list $sourcelistID = "List ID here" ## ID of the source list (click ...


Only top voted, non community-wiki answers of a minimum length are eligible