New answers tagged

0

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


0

Do a select with the desired columns and order and pipe that to Export-CSV. Exmaple Get-Process | select WorkingSet64, ProcessName | Export-Csv c:\testfolder\test.csv i.e. your-PNPcmdlet | select yourColumns | Export-Csv filename and options While there is no direct output to Excel, PowerShell can create an Excel object and write to it using the Excel ...


1

Try using below code block: foreach($contentType in $ContentTypes) { if($contentType.Name -eq 'Knowledge Document' -Or contentType.Name -eq 'TELL Document') { write-host $contentType.Name } } See examples given in below article for more clarification: PowerShell Basics: If -And & If -Or Statements.


0

Use the code below to get the modified by porperty: $web=Get-PnPFile -Url /sites/path/default.aspx $web.ModifiedBy It will shows the user login name and Email address


0

Unfortunately, you don't have option to change this 2 settings in PnP powershell, In fact this are not available in SharePoint powershell also. You have to rely on list.asmx webservice to do this.... Below is example using CSOM, you either have to convert to powershell or us in C#. Ref link - https://social.msdn.microsoft.com/Forums/exchange/en-US/d664cb09-...


0

Please follow below steps which might be helpful: First fetch the lists on which content types are enabled: Get-PnPList | Select-Object Title, AllowContentTypes | Where-Object { $_.AllowContentTypes -Eq $true } Iterate through each list and fetch their associated content types: Get-PnPContentType -List *ListName* -Identity *ContentTypeTitle* If a list ...


0

I found a great post that resolves this: http://blogold.pixelmill.com/3718/running-multiple-versions-of-pnp-powershell/ To find out what version of Pnp PowerShell you are currently running: Get-Module To switch to another version: Import-Module SharePointPnPPowerShell2013 or Import-Module SharePointPnPPowerShellOnline


0

you can do below Run them side by side Out of the box this won't work. Well, you can install them, but PowerShell will automatically load the first one it finds. So in order to use them we will have to do some tweaking. Make sure that you have uninstalled all instances of PnP Powershell that you currently have available on your machine. If you installed ...


0

[Microsoft.SharePoint.Taxonomy.TaxonomyFieldValueCollection] typecasting is incorrect and not needed because PnP PowerShell does that for you. You can simply iterate over $MMSFieldValueColl and fetch the values as below: $MMSFieldValueColl = $libitem["KBCategory"] #Concatenate each term in the value collection $MMSFieldTerms = "" Foreach ($MMSFieldValue ...


1

You need to also additional fetch details as below via Get-PnPUser command: $value = $libitem["KBContentAuthor"] $user = Get-PnPUser -Identity $value.LookupId # added this just for explanation, you can remove it from the code $email = $user.Email $username = $user.LoginName $fullname = $user.Title "Content Author" = $user.Title


1

Your second example is for a "basic" function. It uses the same syntax that we have used in many other languages: the word "function", a name for the function, a left paren, a list of parameters, a right paren, and a code block enclosed in curly brackets. They are quick and easy to write. Your first example is for an "advanced" function that uses a formal ...


0

Enter New name and run this in browser console function ValidateAndSubmit() { return true; } function doesFieldNameConflict(strName) { return false; } You will be now able to save the name.


1

This may not answer but you could try it as it's working in my environment. Get: #region Variables $Username = "user@tenant.onmicrosoft.com" $Password = "password" $siteURL = "https://tenant.sharepoint.com/sites/lee" #endregion Variables #region Credentials [SecureString]$SecurePass = ConvertTo-SecureString $Password -AsPlainText -Force [System....


0

Corrected Script and now it is working... Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue $web = Get-PnPWeb /sites/InterSignWorkgroup $list = Get-PnPList "FWO History" $items = Get-PnPListItem -List $list foreach($item in $items) { $lookup = $item.FieldValues["FWO_x0023_"] Set-PnPListItem -List $list -Identity $item -Values @{"...


1

Sample script for your reference, file Title is empty by default, so make sure Title has value. #region Variables $Username = "user@tenant.onmicrosoft.com" $Password = "password" $siteURL = "https://tenant.sharepoint.com/sites/lee" #endregion Variables #region Credentials [SecureString]$SecurePass = ConvertTo-SecureString $Password -AsPlainText -...


0

SharePoint Online: Get All Lists and Libraries using PowerShell for your reference: http://www.sharepointdiary.com/2015/08/sharepoint-online-get-all-lists-using-powershell.html SharePoint Online: PowerShell to Get All Subsites in a Site Collection: http://www.sharepointdiary.com/2016/02/powershell-to-get-all-subsites-in-sitecollection-sharepoint-online....


1

Get-PnPSearchConfiguration -Scope Site -OutputFormat ManagedPropertyMappings The cmdlet is used to return all custom managed properties and crawled property mapping at the current site collection So, check the custom managed properties and crawled property mapping at your site collection via UI to find if there are only one value matched.


0

PnP have option Get-PnPProp,for list item object, it means passing the Microsoft.SharePoint.Client.ListItem object. "HasUniqueRoleAssignments" can only return by "Get-PnPProperty" Get-PnPProperty


0

I needed to enable "Custom Script" in "https://tenantname-admin.sharepoint.com/_layouts/15/online/TenantSettings.aspx". Everything works now, i was able to run it with pnp.


0

Thanks for the response, but I figured out my issue. When I created the group, I was not giving enough time to create the SP site for the group.Since the site has not been created yet, I get a 403. I just put a "pause" Start-Sleep -Seconds 180 The pause solved my issue and allowed me to use -useweblogin Thanks


0

I use 'service account' to do this instead of using UseWebLogin each time. Hope it helps you. #region Variables $Username = "user@tenant.onmicrosoft.com" $Password = "password" $siteURL = "https://tenant.sharepoint.com/sites/wiki" #endregion Variables #region Credentials [SecureString]$SecurePass = ConvertTo-SecureString $Password -AsPlainText -...


0

Download and install the SharePoint Online Management Shell. Download and install the SharePoint PnP PowerShell Online. Then open the SharePoint Online Management Shell, and run your command again. Mark sure enter the right code provide in the SharePoint Online Management Shell. It working fine in my test.


1

Appreciate this is a few months old but I had a similar problem today. When adding a new node with CSOM, using the NavigationNodeCreationInformation class, you can specify the previous node. If you need to reorder existing nodes programmatically, I think you would have to delete and recreate them (haven't found a way to reorder existing nodes). ...


1

Set JS Link using PNP Field, just remove tilt sign from jslink path. JSLink properties requires relative path without any placeholder. it will automatically add your current site url before '/' Set-PnPField -Identity KIT_sc_ProjectType -Values @{JSLink="/siteassets/jslink/groupcreation_grouptemplates.js";Group="KIT Fields"} -UpdateExistingLists


1

There are several ways to add the JavaScript (JSLink) in Content Editor Web Part to the page: JS, CSOM note that the URL link should be added to ContentLink: var siteUrl = '/sites/MySiteCollection'; var serverRelativeUrl = '/sites/MySiteCollection/Default.aspx'; function addWebPart() { var clientContext = new SP.ClientContext(siteUrl); var oFile = ...


2

Set the JSLink to a field using JSOM: <script type="text/javascript"> ExecuteOrDelayUntilScriptLoaded(setJslink, 'sp.js'); function setJslink() { var context = new SP.ClientContext.get_current(); var web = context.get_web(); var field = web.get_availableFields().getByTitle("Description"); context.load(field); ...


2

You can change the TimeZone using SharePoint Online CSOM like this: #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime....


1

Please check if below helps... Ref link $siteUrl = "http://sandbox0391" $resultSourceName = "Local SharePoint Results" $web = Get-SPWeb $siteUrl $ssa = Get-SPEnterpriseSearchServiceApplication "SBX Search Service Application 2" $queryRuleManager = New-Object Microsoft.Office.Server.Search.Query.Rules.QueryRuleManager($ssa) $site = Get-SPSite $siteUrl $...


Top 50 recent answers are included