powershell
23 TopicsSharePoint (2019) PowerShell Command for SPSite.WebApplication.Properties
We are trying to set and get properties in WebApplication using following code SPSite site = new SPSite(<SiteUrl>) // or SPSite site = SPFeatureReceiverProperties.Feature.Parent as SPSite // set property site.WebApplication.Properties.Add("Property1", "Value1") // get property site.WebApplication.Properties["Property1] We don't get any errors in above code. Now, we want to get and update this property via powershell. We have already tried following commands: 1. Get-SPWeb $site=Get-SPWeb -Identity "<SiteUrl>" $site.Properties 2. Get-SPSite $site=Get-SPSite "<SiteUrl>" $site.WebApplication.Properties 3. Get-SPSite (OpenWeb()) $site=Get-SPSite "<SiteUrl>" $web=$site.OpenWeb() $web.Properties Unfortunately, we were unable to retrieve or set the property using these PowerShell commands, which corresponds to the functionality used in the .NET code. We need assistance in determining how to update or retrieve the property set using the mentioned code via PowerShell.2.1KViews0likes4CommentsPnP-PowerShell Connect-PnPOnline using AppId gives Access denied
I'm creating a PowerShell script to connect to SharePoint Online and authenticate as a registered Azure AD application (not a user). In Azure AD I have registered the application and I have the AppId and AppSecret. Through Azure AD I have granted the application API access to the SharePoint Online API with the application permissions 'Have full control of all site collections' and 'Read and write managed metadata'. I have also performed admin consent for the app by going to the URL: https://login.microsoftonline.com/<tenant>.onmicrosoft.com/oauth2/authorize?client_id=<client id>&response_type=code&prompt=admin_consent. When I use the cmdlet: Connect-PnPOnline -Url $siteUrl -AppId $appId -AppSecret $appSecret no message is displayed as if the connection occurs properly. However, when I use ANY cmdlet (i.e. Get-PnPWeb) I receive 'Access denied. You do not have permission to perform this action or access this resource.' Any help is appreciated.Solved32KViews0likes6CommentsAfter Communication Site upgrade of the root site full-width sections are limited
If you upgrade root site's team site template with a communication site template, the new home page (front page) contains one section that can have a full-width web part and it's the first section (uppermost). You cannot add a full-width section down on the page because it's not available in Add Section menu. Is there a possibility somehow to allow full-width sections also on other slots on the new homepage? The upgrade was done with Powershell: Enable-SPOComm... and it was otherwise successful.805Views0likes3Comments403 with a ctx.load($WEB) executeQuery
I have a powershell script which is failing with a 403 Forbidden. I have tried 2 variants of Connect-PnPOnline $SiteURL = “https://MyDomain.sharepoint.com/sites/MySPSite/” Connect-PnPOnline -Url $SiteURL -Interactive # Connect-PnPOnline -Url $SiteURL -UseWebLogin $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Web = $Ctx.Web $Ctx.Load($Web) $Ctx.Load($Web.AllProperties) $Ctx.ExecuteQuery() The ExecuteQuery returns a 403 forbidden. I am in the ‘Site Owners’ Group for https://MyDomain.sharepoint.com/sites/MySPSite I have the SharePoint Administrator role activated in Portal.Azure.Com >> Azure AD roles What am I missing ? All suggestions gratefully received. Thank youSolved1.6KViews0likes2CommentsScript PowerShell pour générer des fichiers sur Sharepoint
Bonjour, J'utilise un script PowerShell pour télécharger des fichiers dans SharePoint dans des colonnes taguées. Cela fonctionne bien avec tous les intitulés de colonnes, par exemple (Projet) à part la colonne (Type de documents) Pourriez-vous me dire si vous avez une solution pour ce cas, s'il vous plait ? Merci.634Views0likes0CommentsPNP SharePoint Modern Lists DefaultEditFormUrl
Hi, Is there a way with PNP PowerShell to change a modern lists (SharePoint Online) default DefaultEditFormUrl. I know we can get the current values, but looking for a way to set it to my own custom page. Connect-PnPOnline -Url "https://tenanr.sharepoint.com/sites/x" $list = Get-PnPList -Identity "listane" -Includes DefaultDisplayFormUrl, DefaultEditFormUrl, DefaultNewFormUrl $list.DefaultDisplayFormUrl $list.DefaultEditFormUrl $list.DefaultNewFormUrl Thanks 🙂2.6KViews0likes1CommentUsing PowerShell to change page banner image
Hi Folks, Currently have a automatic site creation tool up and running. I know using the PnP engine no content will be included in the template, but is there any way on the newly created site on the main home page (Modern Page) I can change the banner image using PowerShell to reference an image stored somewhere else? Thanks!Solved8.3KViews0likes4CommentsSetting Up Banner Image in Programmatic Way
Hi All, I was trying to add background image in header section of sharepoint site. Through sharepoint UI we were following below step to set the background image of header section: Settings -> Change the Look -> Header -> Set the header layout as "Extended" -> Set the required background image as Optional Image. Now we are looking for a programmatic way, either from powershell or PnP-Provisioning Template to apply the same background image to number of sites. Any Suggestions are appreciated. Thank You.876Views0likes0CommentsCan't turn off "Visible on New Button" for Content Type using PnP PowerShell
Hi, I'm having trouble turning off the "Visible on New Button" option for a Content Type on a Document Library. I'm trying to use the "UniqueContentTypeOrder" to do that. So far, it's not taking -- any thoughts? Snippet of script below. Many thanks. $doclib = Get-PnPList -Identity "Quotes" -Includes RootFolder.UniqueContentTypeOrder $lct = $doclib.ContentTypes $ctx.Load($lct) $ctx.ExecuteQuery() $rootFolder = $doclib.RootFolder $lucto = $doclib.ContentTypes | ?{$_.Name -ne "<Content Type I'm Trying to Hide>"} $list = New-Object 'System.Collections.Generic.List[Microsoft.SharePoint.Client.ContentTypeId]' foreach ($i in $lucto) { $id = $i.Id $list.Add($id) } $rootFolder.UniqueContentTypeOrder = $list $rootFolder.Update() $doclib.Update()4.2KViews0likes4CommentsHow do I set DenyAddAndCustomizePages for SharePoint 2019 communication site
Hello, I've set up a fresh new instance of SharePoint 2019, I've set up a communication site in Dev environment and wanted to save this site as a template, unfortunatly the option is not available and I get an "access denied" when accessing to the page thanks to the url. Anyonye know if the same option can be applied as we can you in SharePoint Online: set-sposite https://tenant.sharepoint.com/sites/communication -denyaddandcustomizepages $false Thanks by advance26KViews0likes7Comments