New answers tagged

0

I figured out a solution. I Used: Add-PnPFileToProvisioningTemplate -Path SiteTemplate.xml -Source '.\resources\MyImage1.png' -Folder 'CompanyAssets' Which inserted the MyImage1.png into the CompanyAssets folder in the newly provisioned Team site.


0

As Get-PnPUserProfileProperty is also not working for me for the private properties, "Only Me" properties, I am sharing another way to get "Only Me" properties by using the web service /_vti_bin/UserProfileService.asmx?wsdl. Below is a code sample $adminUrl = "https://tenant-admin.sharepoint.com"; $accountName = "i:0#.f|membership|user@tenant.onmicrosoft....


0

Not sure if it meets your requirement but it is supported to create and modify a DLP policy using PowerShell. Here is a PowerShell example that a DLP policy named GlobalPolicy for the specified SharePoint Online and OneDrive for Business locations: New-DlpCompliancePolicy -Name "GlobalPolicy" -Comment "Primary policy" -SharePointLocation "https://my.url","...


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-...


1

Using PnP-PowerShell, you can do it like below: $adminUrl = "https://<tenant>-admin.sharepoint.com" $newSiteUrl = "https://<tenant>.sharepoint.com/sites/Pensaerniaeth" $ownerEmail = "<your.name@your.email.com>" $siteTitle = "Pensaerniaeth" # Translates to "Architecture" - Bing Translator $siteTemplate = "SITEPAGEPUBLISHING#...


1

-IncludeSiteCollectionTermGroup will only export terms that are defined at the Site Collection level, not the terms in the managed term store. These terms are usually created when you define fields with custom term sets or when using Managed Navigation. Therefore any terms in the managed term store (that are available across your sites in the tenant) will ...


0

You can open the .xml file in a text/code editor and do a search & replace with a corresponding user from your second tenant. There are a few main sections that can include users in the provisioning template. If you do not need to provision these you can remove the whole section. These are: <pnp:SiteDesigns /> <pnp:Security /> <pnp:...


0

We will face this issue when we have already created the site with the group and there trying to run the Apply-PnPProvisioningTemplate command- with the new site this issue will not come. In order to work with the current template, we need to do few changes in the PnP template before running the Apply-PnPProvisioningTemplate command. Sample PnP Template: &...


1

This error might have come due to the throttling so you can try increasing the value of RetryCount parameter Example : Invoke-PnPQuery -RetryCount 10 Notes : The error what you are getting now, you may not get after sometimes, because throttling error comes when resource utilization in the target connection is high and this is not fixed, this gets ...


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 -...


0

You can actually do this with the following one-liner! Get-PnPList -Includes ContentTypes | Where-Object {$_.ContentTypes | Where-Object Name -eq "Knowledge Document"}


0

Demo code for your reference: Connect-SPOService Get-SPOSite | Select @{ L = "url"; E = { $_.url } }, @{ L = "DefaultLinkType"; E = { $_.DefaultSharingLinkType } } | Export-Csv -Path c:\export.csv


0

Here is a good cheat sheet for app permissions. To grant full access (tenant admin) you would use the following: <AppPermissionRequests AllowAppOnlyPolicy="true"> <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" /> </AppPermissionRequests>


3

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 = ...


2

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 ...


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....


0

I started down the road of building a function that returns the complete json from the component received from Get-PnPClientSideComponent. The information is all there. It certainly can be improved upon but hope it helps. function Get-PnpQuickLinksJson{ param( [parameter(Mandatory=$true)][OfficeDevPnP.Core.Pages.CanvasControl]$component ) $json = "{ ...


0

Try running $web.Context.ExecuteQuery() before 2nd $web = Get-PnPWeb in your code. complete script will be like below: $varURL = Read-Host -Prompt 'Provide URL to site' Connect-PnPOnline -Url $varURL #Set all your variables $web = Get-PnPWeb -Includes Title $OwnersGroup = $web.Title.substring($web.Title.IndexOf(' | ')+3)+' Owners' $MembersGroup = $web.Title....


1

Yes. You can use app password to authenticate SharePoint Online site using PowerShell PnP. Hit below URL: Connect-PnPOnline -Url https://contoso.sharepoint.com It will open a pop-up like below where you can pass user username and app password: And, If you are using: Connect-PnPOnline -Url https://contoso.sharepoint.com -PnPO365ManagementShell This ...


0

Try this: $checkFile = Get-PnPFile $TargetFileURL **-AsListItem**


Top 50 recent answers are included