SharePoint
111 TopicsConnect to SPO from Azure automation runbook using a certificate
How to connect to SPO using Pnp powershell Connect-PnpOnline using a certificate with script being executed from Azure automation runbook. I have exported a self-signed certificate and uploaded to Azure Automation. When I use the following it does not work. Another thing I noticed is that Connect-PnPOnline requires a certificatePath paramater. What are my options here when certificate is stored in Azure automation. This does not work: Connect-PnPOnline -Thumbprint "3234234"-Url $url -ClientId $clientId -Tenant "tenant.onmicrosoft.com" Alternative, with script being run from runbook what could I use for path Connect-PnPOnline -CertificatePath "??????" -CertificatePassword "3234234"-Url $url -ClientId $clientId -Tenant "tenant.onmicrosoft.com"9.7KViews0likes9CommentsRename-pnpFile gives me access denied with admin rights
Hello! I have problems renaming my files. I'm using these commands: #this is one command i tried connect-pnponline -url "https://contoso.sharepoint.com/sites/Clients" -interactive -validateconnection $file = Get-PnPFile -Url "/sites/Clients/folder/subfolder/IT_testi_password.txt" Rename-PnPFile -SiteRelativeUrl $file -TargetFileName "renamedfile.txt" -Force -Verbose # this is another connect-pnponline -url "https://contoso.sharepoint.com/sites/Clients" -interactive -validateconnection Rename-PnPFile -SiteRelativeUrl "/sites/Clients/folder/subfolder/IT_testi_password.txt" -TargetFileName "renamed.txt" -Force -Verbose I tried those commands too with overwrite but I only get access denied (I dont know what is checking to say me that because i can put everything in the source and it says me same ) the error: #I'm putting this error to show that i can put anything i want Line | 4 | Rename-PnPFile -SiteRelativeUrl "asrfeqrew" -TargetFileName "workingc … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Access denied. PS /Users/user> #and this one is a common one Rename-PnPFile: /Users/user/Desktop/project/Scripts/Untitled-1.ps1:4:1 Line | 4 | Rename-PnPFile -SiteRelativeUrl "/sites/Clients/folder/subfolder/IT_testi_password.txt" -T … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Access denied. I'm using visual studio with a mac and have Sharepoint administrator right, also i can rename the same file via web. Can someone help me with this problem?1.6KViews0likes4CommentsSharePoint library choice column formatting
I am trying to format a JSON for a Choice column that has been set to "choice pills". I am trying to change things like font color, background color, border etc. So far trying to do this but doesn't seem to work: { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "style": { "flex-wrap": "wrap", "display": "flex" }, "children": [ { "forEach": "__INTERNAL__ in @currentField", "elmType": "div", "style": { "color": "=if(@currentField == 'Sales', '#ff0000', if(@currentField == 'Marketing', '#006aff', if(@currentField == 'Warehouse', '#b882d7','green')))", "background-color": "=if(@currentField == 'Sales', '#FAA0A0', if(@currentField == 'Marketing', '#c1d3f7', if(@currentField == 'Warehouse', '#e4c1f7','#DAF7A6')))", "box-sizing": "border-box", "padding": "4px 8px 5px 8px", "overflow": "hidden", "text-overflow": "ellipsis", "display": "flex", "border-radius": "16px", "height": "24px", "align-items": "center", "white-space": "nowrap", "margin": "4px 4px 4px 4px" }, "attributes": { "class": { "operator": ":", "operands": [ { "operator": "==", "operands": [ "[$__INTERNAL__]", "Sales" ] }, "sp-css-backgroundColor-BgCornflowerBlue sp-css-color-CornflowerBlueFont", { "operator": ":", "operands": [ { "operator": "==", "operands": [ "[$__INTERNAL__]", "Marketing" ] }, "sp-css-backgroundColor-BgMintGreen sp-css-color-MintGreenFont", { "operator": ":", "operands": [ { "operator": "==", "operands": [ "[$__INTERNAL__]", "Warehouse" ] }, "sp-css-backgroundColor-BgGold sp-css-color-GoldFont", "sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralSecondary" ] } ] } ] } }, "txtContent": "[$__INTERNAL__]" } ] }Solved2.9KViews0likes3CommentsSharePoint (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.1.9KViews0likes4CommentsClickable Button on Gallery View Document Library
Hello, I have a document library where social media assets are stored. I would like to create a gallery view of the document library that displays a "Download" button, so when the user selects, the file is automatically downloaded to their device. I have figured out how to add the Download button, which works perfectly in the List view. When you switch to gallery view, the button does not display, but I was able to get the button to show up by adding"columnFormatterReference": "[$Download]" to the Format view JSON. However, when the user clicks on the Download button from the gallery view, the file opens. I removed the following JSON code, so the file does not open in a new tab: "customRowAction": { "action": "defaultClick" Now I just need to figure out how to make the "Download" button clickable. Any help would be greatly appreciated. I'm brand-new to JSON and coding in general.Solved4KViews0likes9CommentsInvoke-PnPSiteTemplate : The parent content type specified by content type identifier
Hello All, I am working on PnP site provisioning in SharePoint online. I am able to create template xml file using the below command: Get-PnPSiteTemplate -Out "PnP-Provisioning-File.xml" -PersistBrandingFiles -IncludeAllPages -IncludeSiteGroups -Force But when applying the template to target site, it is throwing the below error: Invoke-PnPSiteTemplate : The parent content type specified by content type identifier 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39004C1F8B46085B4D22B1CDC3DE08CFFB9C does not exist. When I have done troubleshooting then got to know that "Enterprise Wiki Page" content type is missing. My question is why Get-PnPSiteTemplate command is not including "Enterprise Wiki Page" content type and how to resolve it?Solved1.8KViews0likes2CommentsMerge the content of two folders while moving or copying if their name is same.
Is there any way, or the simplest way to merge the content of two folders when their name is the same, while we are moving or copying the folder? For example, if we move a folder named "A" and there is already a folder named "A" in the destination then, the content of source folder "A" should get merged with the destination folder name "A". This can be tested in windows explorer, if you create two folders of the same name in two different locations, and then try to copy or move the folders in that location, then you will see that the data in the destination folder is a merged version of both the folder. How to implement this in SPFx using SharePoint APIs2.1KViews0likes0CommentsHow to use SharePoint search query with SharePoint Granular access permissions?
I want to execute SharePoint search API with granular access for that I've changed 'Sites.ReadWrite.All' permission to 'Sites.Selected' permission, so that application would have all sites access but during search I'm getting unauthorize error ``` {"odata.error":{"code":"-1, Microsoft.Office.Server.Search.REST.SearchServiceException","message":{"lang":"en-US","value":"Unauthorized."}}} ``` Also tried to give sites.selected permission at tenant level, that also not works, if the only solution is to give 'Sites.ReadWrite.All' or 'Sites.Read' then there is no use of granular level access implementationSites.Read.all will allow all sites if granted. My query is similar to below -: https://tenant.sharepoint.com/_api/search/query?querytext='*+AND+(Path:"https://tenant.sharepoint.com/sites/SITE1/RECORDS" OR Path:"https://tenant.sharepoint.com/sites/SITE2/RECORDS")'&trimDuplicates=false&selectProperties='Column1,Column2'&refiners='Column1OWSTEXT'&refinementFilters='Column1:equals(\"xxxxx\")'&rowLimit=5 Some other references regarding my question. https://sharepoint.stackexchange.com/questions/306397/how-to-use-sharepoint-search-query-with-sharepoint-granular-access-permissions?newreg=dbcbb62ae019481c9a864f537ecd0faf https://sharepoint.stackexchange.com/questions/306432/is-that-sites-selected-permissions-level-allows-the-sharepoint-online-global Really appreciate any response on this or alternative approach to to achieve this.741Views0likes0CommentsCannot create new site page by choosing saved template
I am trying to create a new site page, however i am not able to save the page by using save as draft nor able to publish it. The page keeps on auto saving at the back end and creates multiple copies under site pages. Inner-Message: Invalid data has been used to update the list item. The field you are trying to update may be read only. Exception-Message: We're sorry, we encountered an unexpected error. Please refresh the page and try again. Refreshing the page does work out, but it removes the web parts in the saved template, which is not helpful. can anyone please help me with this.780Views1like1CommentSharePoint App-Only authentication security risks
I am assessing the security risks associated with older SharePoint App-Only authentication method. As per my analysis, this method is less secure than using the Azure AD App Registrations. Both SharePoint App and an Azure AD App can authenticate with just a Client ID and a Client Secret. Anyone with these two properties can connect and invoke the APIs from anywhere in the world. However, with Azure AD App, we have some protection offered by Azure AD built-in intelligent algorithms that could detect or protect against a potential attack. Furthermore, we could use Conditional Access for Workload identities to secure these principals. On the contrary, SharePoint App Only method does not have that protection as it bypasses the Azure AD completely, no conditional access policies apply. Has anyone out there evaluated the security risks of these two and could share their thoughts?2.2KViews0likes2Comments