Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
6

This is the method using PnP Online. Retrieve the additional properties using Get-PnPProperty Connect-PnPOnline -Url $siteUrl $context = Get-PnPContext For Files $file = Get-PnPFile -Url $filePath -AsListItem Get-PnPProperty -ClientObject $file -Property HasUniqueRoleAssignments, RoleAssignments if($file.HasUniqueRoleAssignments -eq $...


6

Connect-PnPOnline https://yoursite.com/sites/yourFIRSTsite Get-PnPProvisioningTemplate -Out "MyTemplate.xml" -Handlers Lists,ContentTypes Disconnect-PnPOnline Connect-PnPOnline https://yoursite.com/sites/yourSECONDsite Apply-PnPProvisioningTemplate -Path "MyTemplate.xml" Disconnect-PnPOnline Depending on how many lists/content types are on the site you ...


6

Unfortunately, There is no direct parameter like -View to specify your View Name in Get-PnPListItem Meanwhile, as a workaround solution, you can pass the CAML Query to the -Query parameter based on your View setting. Ex: Get-PnPListItem -List Tasks -Query "<View><Query><Where><Eq><FieldRef Name='GUID'/><Value Type='Title'&...


6

I can show how to get this using JavaScript and REST: $.ajax({ url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/RoleDefinitions/getByName('Contribute')", async: false, headers: { 'accept': 'application/json;odata=nometadata' }, complete: function (request) { var basePermissions = new SP.BasePermissions(); ...


5

For starters, you compare on the wrong property (and you are not using a PowerShell compare operator): Change if($mylistsToIgnore==$eachList.TempladID) to if($mylistsToIgnore -eq $eachList.TemplateID) Also, another typo: Change foreach ($eachList in $oListColl) to foreach ($eachList in $myListColl)


5

For most PowerShell cmdlets, try something like this: get-pnpgroupmembers -identity "visitors group" | select * or get-pnpgroupmembers -identity "visitors group" | Get-Member As the PNP cmdlets are not populating all of the CSOM properties, you will get an error with "select *", and selecting some of the properties returned by Get-Member like Alerts and ...


5

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

Try <View Scope='Recursive'> ViewScope enumeration Example, Get Items Under Folder CAML


4

Unfortunately, the answer is no at the moment. PowerShell Core 6.0 is built on top of .NET Core 2.0 runtime. But the thing is, PnP PowerShell depends on PnP CSOM Core components which are dependent on SharePoint CSOM libraries. Now, SharePoint CSOM libraries are dependent internally on some "other" libraries which are, as yet, not compatible with .NET Core. ...


4

I have the same issue. A workaround is to use the parameter -UseWebLogin. Connect-PnPOnline -Url https://collab.myCorp.com -UseWebLogin


3

By list item object, it means passing the Microsoft.SharePoint.Client.ListItem object. You are currently passing string which will not work. You need to use Get-PnPListItem to get the list item and then pass it to the Set-PnPListItemPermission command. To do that, you can use it as below: $listItem = Get-PnPListItem -List 'Test' -Id 1 or passing CAML ...


3

There is no TemplateId property in SPList object. You have to find it by TemplateFeatureId in SPWeb.ListTemplates. $myListColl = $eachWeb.Lists $mylistsToIgnore = @(101) foreach ($eachList in $myListColl) { $listTemplate = $eachWeb.ListTemplates | ? {$_.FeatureId -eq $eachList.TemplateFeatureId} if ($mylistsToIgnore.Contains($listTemplate....


3

Here is a tool which we used for SharePoint 2007. http://spm.codeplex.com/releases/view/22762


3

Get-PnPListItem -List $targetList -Query "<View Scope=`"RecursiveAll`"><Query><Where><Eq><FieldRef Name = 'FileLeafRef'/><Value Type = 'Text'>Test.txt</Value></Eq></Where></Query></View>" View Element


3

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue; $spSite=Get-SPSite -Identity "http://sp/sites/dev" $spwWeb=$spSite.OpenWeb() $spAuditQuery=New-Object Microsoft.SharePoint.SPAuditQuery($spSite) $Today = [DateTime]::Today $DateLimit = $Today.AddDays(-7) $spAuditQuery.SetRangeStart($DateLimit) $...


3

Here is what I ended up needing to do if someone else needed something like this Import-Module ActiveDirectory #will required to be downloaded/installed $Url = 'https://SharePoint/Site/Path' $Library = 'Team Reports' $RootFolder = '/Team Reports/Engineers' Connect-PnPOnline -Url $Url # Get Folders in the Root folder $folders = Get-PnPFolderItem -...


3

You can use the Set-PnPDefaultColumnValues command to set the value. Use it as below: Set-PnPDefaultColumnValues -List Documents -Field TaxKeyword -Value \"Company|Locations|Stockholm\"" where the term Stockholm is located in the Locations termset inside Company term group. If you know the guid of the term, then you can do it as: Set-...


3

1) You need SharePoint tenant admin access to enable Site collection app catalog. It is assumed that the we already have a tenant app catalog. If its not present, you need to create that first and then run the PS to add SCA. 2) Add-PnPSiteCollectionAppCatalog commandlet accepts the parameter Site which can be a string or Site object . So, you can also use ...


3

You can use the {{listid:ListName}} token instead of hard-coding the GUID. When you use this token , the provisioning engine will fix the placeholder with the actual value of the List ID. For example, if your list/document library name is Documents, use {{listid:Documents}}. Put the below line of code in your template xml file and then PnP will fix it for ...


3

This is a CSOM limitation wherein the ViewCreationInformation object doesnt have a property to set the URL. It takes only the Title value. Also, the correct commandlet to create view is Add-PnPView. Would suggest that you update your PnP PowerShell to the latest version. So, what you can do is use the Add-PnPView commandlet to create a view as: Add-...


3

There are 2 ways you can avoid such cases, 1. Use Try Catch block Reference msdn try{ Get-SPOSite -Identity $siteUrl } Catch { write-host “error in finding the site”} 2. Change the logic and use filter to handle the null variable something like this $objSite = Get-SPOSite -Filter {Title -eq “XYZ”} This way if the site title is not found, you will end ...


3

After you create your field using Add-PnPField, you need to get that field using Get-PnPField and set the default value as below: $field = Get-PnPField -List CustomList -Identity "BoolField" $field.DefaultValue = "0" $field.Update() Invoke-PnPQuery Also, you can use PnPFieldFromXml itself to create a boolean field with No as default value as : $fieldXml = ...


3

Please see below, You can get the complete list of PNP commands here Connect-SPOService = Connect-PnPOnline Disconnect-SPOService = Disconnect-PnPOnline Set-SPOUser = nothing equal for it. Set-SPOSite = Set-PnPSite Get-SPOSite = Get-PnPSite Add-SPOSiteCollectionAppCatalog = Add-PnPSiteCollectionAppCatalog


3

You can get the relative URL this way: $file = Find-PnPFile -Match myFile.docx $file.ServerRelativeUrl Just prefix https://tenantName.sharepoint.com to get the absolute path.


3

You need to use Get-PnPGroupMembers command. Use it as mentioned below where Identity would be the title of the group: Get-PnPGroupMembers -Identity "Visitors Group Name" Reference - Get-PnPGroupMembers You can also use Get-PnPGroup command as well: $group = Get-PnPGroup -Identity "Visitors Group Name" -Includes Users $group.Users Reference - Get-...


3

I don't know the exact number of user properties in each sharepoint version. But you can use below links to see the list of default user profile properties in SharePoint 2010,2013 and Office 365. Using this properties you can query your groups. Sources: Default user profile properties (SharePoint Server 2010). Default user profile property mappings. O365 ...


3

In general you can use wildcards (*) with the select pipe. This works with any variable that has properties. To select ALL properties and see what their values are you can do something like the following: get-pnpgroupmembers -identify "visitors group" | select * Unfortunately if you have a lot of items in your pipeline from get-pnpgroupmembers you'll get ...


3

Right now you are iterating all lists that has the base type "Document Library". If you want to target a specific library you should use the method "Get-SPList" instead of the first for-loop. $list = Get-SPList -ListName "Video" -Web $web If you don't have the get-splist cmdlet use this $list = $web.Lists["Video"] [Check if the file extension is .mp4] ...


3

Yes, you can use Get-PnPListItem with CAML query to fetch the based on your conditions and then update them using Set-PnPListItem and passing the SystemUpdate parameter which wont change the modified and modified by fields. You can modify from below sample code for Active projects : $listItems= Get-PnPListItem -List "Project Management" -Query "<View>...


3

Sample demo to export list of data to CSV. $username = "lee@tenant.onmicrosoft.com" $password = "pw" $secstr = New-Object -TypeName System.Security.SecureString $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)} $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr $siteurl = "https://tenant....


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