pnp / pnp-powershell Goto Github PK
View Code? Open in Web Editor NEWSharePoint PnP PowerShell CmdLets
Home Page: https://pnp.github.io/powershell
License: Other
SharePoint PnP PowerShell CmdLets
Home Page: https://pnp.github.io/powershell
License: Other
Hello,
Firstly thank you so much for putting this together!
I've been experimenting with the cmdlets and have had sucsess in creating a Web, uploading a file and setting a Webs logo
The cmdlet I'm most desperate to use however is Add-SPOJavaScriptLink. I have tried the following syntaxes but each one returns the error message at the bottom
I am a Site Collection admin for the Site in question and a Global Admin for the Office 365 tenancy
I would like to add the link at the Site Collection level but have also tried with -Scope set to Web
I couldn't see any prerequisites that I am missing.... can you point me in the correct direction?
Add-SPOJavaScriptLink -Key "ALjQuery" -URL "https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js" -Scope Site -Web "https://siteurl.sharepoint.com"
Add-SPOJavaScriptLink -Key "ALjQuery" -URL "~sitecollection/SiteAssets/jquery-1.9.0.min.js" -Scope Site
Add-SPOJavaScriptLink -Key "ALjQuery" -URL "/SiteAssets/jquery-1.9.0.min.js" -Scope Site
Add-SPOJavaScriptLink -Key "ALjQuery" -URL "SiteAssets/jquery-1.9.0.min.js" -Scope Site
Add-SPOJavaScriptLink -Key "ALjQuery" -URL "~sitecollection/SiteAssets/jquery-1.9.0.min.js" -Scope Site -Web "https://siteurl.sharepoint.com"
Add-SPOJavaScriptLink -Key "ALjQuery" -URL "https://siteurl.sharepoint.com/SiteAssets/jquery-1.9.0.min.js" -Scope Site -Web "https://siteurl.sharepoint.com"
Add-SPOJavaScriptLink : Access denied. You do not have permission to perform this action or access this resource.
At line:10 char:1
+ Add-SPOJavaScriptLink -Key "ALjQuery" -URL "~sitecollection/SiteAssets/jquery-1. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-SPOJavaScriptLink], ServerUnauthorizedAccessException
+ FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.AddJavaScriptLink
If you connect to an O365 tenant with an appropriately permissioned account and try to create a new term group ala:
Add-SPOTaxonomyField -GroupName "Test01"
the term group is created, however it looks like there is something wrong with the object returned.
format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may
need to be explicitly requested.
+ CategoryInfo : NotSpecified: (:) [format-default], CollectionNotInitializedException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.CollectionNotInitializedException,Microsoft.PowerShell.Commands.FormatDefa
ultCommand
Other term group related commands are also not working, but I'm guessing this is the root cause. It looks to me as if the collection returned is throwing an error.
This is just a point for open discussion about the ability to publish the PnP modules to the PowerShell Gallery as well as from here as part of the monthly release cycle. I don't think that there will be much more work required to accomplish this but this would allow a single PowerShell Command to update the module after release vs the current possible Uninstall/Reinstall that can be required.
Not sure if this is happening for other docs, but the Connect-SPOnline help details are being rendered multiple times. See: https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/ConnectSPOnline.md
I'm trying to create a universal provisioning template for a subsite. Is there any solution to provision a proper lookup to a list on a parent site collection?
When I manually add the Lookup Column from the parent site Collection it is working fine. Creating a provisioning template and apply it (to the same site) the connection to the List is broken and the lookup remains empty even if there are values on parent side.
Any suggestions?
Thanks
Roman
Hi
The documentation for Remove-SPOWebPart is a little confusing there are 15 pairs of "Syntax" and "Parameters". I suspect there should only be one.
Here are some examples of the syntax for the MD file 👎
Remove-SPOWebPart -Title "Table of Contents" -ServerRelativePageUrl /Pages/Chickpeas.aspx
Remove-SPOWebPart -Identity "8a23981f-5d27-4904-b199-45a582101801" -ServerRelativePageUrl /Pages/Pulses.aspx
Regards
Nigel
Hi,
Could you provide some more details on the Add-SPOView cmdlet, particularly around the Query string? Can it be used to define groups and filters?
The list parameter for the URL should be case insensitive as either case resolves to the same location. Currently, the case must match the exact case defined in the list.
I've just had following error message, by trying to apply an existing template file, with cmdlet in subject:
However everything seems applied correctly. I'm wondering if this error can be ignored, or what is the source of this error
After connecting to a site collection,
I am getting the following error: when I run get-spoweb |fl
get-spoweb : The pipeline has been stopped.
At line:1 char:1
- CategoryInfo : WriteError: (:) [Get-SPOWeb], PipelineStoppedException
- FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.GetWeb
fl : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
At line:1 char:13
~~
Any idea why? what am i doing wrong? it works fine for get-spoweb | ft, but fails with the full list. I want to see all of properties for the web object.
Hi,
I'm experiencing an issue trying to add items for a list. In the code below, I create a field, assign it to a new content type and then create a list with that content type as its default.
$field = Add-SPOField -DisplayName "My field" -InternalName "myfield" -Type Text -Group "My Group"
$pct = Get-SPOContentType -Identity "Item"
$ct = add-spocontenttype -name "My CT" -ParentContentType $pct -Group "My group"
Add-SPOFieldToContentType -field "My field" -ContentType "My CT"
new-spolist -title "My list" -url "mylist" -Template GenericList -EnableContentTypes
Add-SPOContentTypeToList -List "My list" -ContentType "My CT" -DefaultContentType
However, when I try add an item the following error comes up:
Add-SPOListItem -List "My list" -ContentType "My CT" -Values @{"Title"="my title"; "My field"="some data"}
Add-SPOListItem : Column 'aMy field' does not exist. It may have been deleted by another user. /sites/deptest2/mylist
At line:1 char:1
+ Add-SPOListItem -List "My list" -ContentType "My CT" -Values @{"Title ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-SPOListItem], ServerException
+ FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.AddListItem
Thanks for your help.
Can we have support for boolean values for the Powershell.Commands Set-SPOWebPartProperty? I already use the string and integer values in my Powershell scripts but have to use extra CSOM code to make this work.
Hi,
When I use the switch -EnableVersioning
with New-SPOList I always get the error
new-spolist : The list does not support minor versioning.
Regards,
Hi having an issue with some code
Connect-SPOnline -url https://tenant.sharepoint.com/sites/Development -Credentials tenantCreds
$csv = Import-Csv C:\CSVs\ReportNumbers.csv
Get-SPOContext
foreach ($item in $csv)
{
$num = $item.EmployeeNumber
Add-SPOListItem -List Tabs -Values @{"Title" = $num;}
}
I get an error
format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
+ CategoryInfo : NotSpecified: (:) [format-default], CollectionNotInitializedException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.CollectionNotInitializedException,Microsoft.PowerShell.Commands.FormatDefaultCommand
The code I have here isn't the exact piece that I orringally got the error with but it does replicate.
The reason I have the Get-SPOContext is that im using a foreach statement in which it downloads each item, extracts data from an InfoPath xml file, then adds to a SharePoint list.
I had to have the Get-SPO Context within the foreach as it would not load the file
# Get the list item
$spoItem = Get-SPOListItem -List ICP -Query "<View><Query><Where><Eq><FieldRef Name='Employee_x0020_Name' /><Value Type='Text'>$uName</Value></Eq></Where></Query><ViewFields><FieldRef Name='Employee_x0020_Name' /></ViewFields></View>"
$ctx = Get-SPOContext
# get the file and properties
$file=$spoItem.File
$ctx.Load($file);
Execute-SPOQuery
$spoItem.Name
PowerShell commands do not work well with SiteCollections which have spaces in their url. Trying to issue commands to these sites will produce NullReference execptions.
Powershell script which reproduces the problem:
$username = "username"
$password = convertto-securestring "password" -asplaintext -force
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $password
$url = "https://tenant.sharepoint.com/sites/site%20with%20space"
Connect-SPOnline –Url $url –Credentials $credentials
Get-SPOSubWebs | foreach-object { write-host $_.Url }
This is because:
I'll create a pull request which modifies the SPOnlineConnection constructor to use the Uri.AbsoluteUri too.
Get an error message that the endpoint does not use ADFS for authentication.
When I take a look at fiddler there are 3 more roundtrips to SharePoint before the location header gives the correct ADFS location
1: /_trust/ -> location is /_layouts/15/authenticate.asxp
2: /_layouts/15/authenticate.aspx -> location is /_login/autosignin.aspx (This is a custom login page for SharePoint)
3: /_login/autosignin.aspx -> location is /_trust/default.aspx
4: /_trust/default.aspx?trust= -> location is the ADFS url.
The current code does only 1 try and fails
SPOnlineConnectionHelper.cs lines 254 - 280
Issue also posted on pnp/PnP#1118
I've ran a little test where I tried creating a property bag and then reading it:
Set-SPOPropertyBagValue -key SiteType -Value Practice
However, Get-SPOPropertyBag does not return the new property bag. Has anyone else faced this problem?
Thanks,
-Haniel
Hi,
I tried to use New-SPOWeb. The subsite is created but unfortunately the script breaks with an error message:
format-default : The collection has not been initialized. It has not been requested or the request has not been
executed. It may need to be explicitly requested.
+ CategoryInfo : NotSpecified: (:) [format-default], CollectionNotInitializedException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.CollectionNotInitializedException,Microsoft.PowerShell.Comma
nds.FormatDefaultCommand
I tried to catch this exception with no luck. What can I do?
Thanks
Roman
I have been testing content types and list instances and finding this scenario difficult.
I create a site content type then a list. The list is configured to enable content types. I add my content type then remove the base content type. The provision list contains both the base content type AND my custom content type.
i.e. The provisioned list contains "Document" and "My Custom Document" content types even though my template only contains "My Custom Document" content type. I do not want the base "Document" content type included in the provisioned site. The same holds true for Lists where the "Item" Content type is included with my custom Content Type.
Is it possible to set the toolbar property on a view with Set-SPOWebPartProperty?
I've tried this:
Set-SPOWebPartProperty -ServerRelativePageUrl /sites/dev-site/ListName/Forms/View Name.aspx -Identity 4f6edf75-3596-482b-b15e-7568293d27b6 -Key "Toolbar" -Value "None"
But I get error saying "File not found". I've also tried with the whole url to the view (with "View name.aspx") but it also says "File not found".
When running New-SPOWeb a web object is returned where ServerRelativeUrl is not set. Get-SPOSubWebs does set ServerRelativeUrl. So to create a new web I'm running something like this:
$web = Get-SPOSubWebs -Recurse | where {$_.Url -eq $fullWebUrl}
if ($web -eq $null)
{
$web = New-SPOWeb -Url $weburl -Title $sitetitle -Template $sitetemplate -Web $parentweb
$web = Get-SPOSubWebs -Recurse | where {$_.Url -eq $fullWebUrl}
}
Should the New-SPOWeb set the ServerRelativeUrl of the web?
Hi,
I'm running Get-SPOProvisioningTemplate command against O365. After successfully connecting to the site using Connect-SPOnline, I ran the following command:
Get-SPOProvisioningTemplate -Out "c:/temp/template.xml"
Progress bar indicates that command is running, then the following error is displayed
I just tried setting web's SiteLogoUrl on on-premises Sharepoint 2013 (can't remember patch version) and I got that "SiteLogoUrl property not found". I tried this with Set-SPOSite cmdlet and also assigning to $web.SiteLogoUrl a value after which executing Execute-SPOQuery I got the error. The release which I'm using is the latest (october 2015 bits, I guess)
Seems that since 12 days, there is a version 2, but the readme only mentions version 1 from 2014.
When I set INDEXED to true in my Field definition in my template file then I am getting the following error:
Apply-SPOProvisioningTemplate : /Lists/RollingNews : Cannot complete this action.
Please try again.
At P:\TFS\Meggitt\Meggitt.Installer\Modules\Office365Module\Office365Module.psm1:179 char:13
Apply-SPOProvisioningTemplate -Path $siteAssetTemplateXML -Web $web
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have created a field of UserMulti type that is associated with a list. I've tried several formats for adding a user to the field but none seem to work:
domain\login
email
username
full name
Is there another format I should be using?
Thanks.
Hi Erwin,
is it just me, or the documentation for the cmdlet in subject is duplicated 13 times the same content within the same page?
Example:
New-SPOWeb -Title "Administration" -Template "STS#0" -Locale 1033 -Url administration -BreakInheritance
Replicated numerous times
I have been trying to make the export taxonomy work for me using the following:
Connect-SPOnline -Url https://mydemo1.sharepoint.com -Credentials (Get-Credential)
Export-SPOTaxonomy -TermSetId 1e193f11-eb5f-4f76-8747-ddbb8902cd2b -TermStoreName "Site Navigation"
but this keeps resulting in the following error:
Export-SPOTaxonomy : Specified argument was out of the range of valid values.
Parameter name: index
Then when I corrected the term store name:
Export-SPOTaxonomy -TermSetId fd829cd1-8970-448f-9152-93c1fbb5eaf3 -TermStoreName "Taxonomy_hrn/SoS5OfY1gQN3xJiX6g=="
I got
Export-SPOTaxonomy : Cannot invoke method or retrieve property from null object. Object returned by the following call stack
is null. "GetTermSet
GetByName
TermStores
Microsoft.SharePoint.Taxonomy.TaxonomySession.GetTaxonomySession
"
At line:1 char:1
- CategoryInfo : WriteError: (:) [Export-SPOTaxonomy], ServerException
- FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.ExportTaxonomy
Then when I corrected the guid to point to a termset it all worked and I got my export:
Export-SPOTaxonomy -TermSetId dda17137-1adf-43e4-bf3b-ce7be1fc943e -TermStoreName "Taxonomy_hrn/SoS5OfY1gQN3xJiX6g=="
Then now my issue:
Is there a way to debug these commands in Visual studio stepping through will help me understand what each command expects. I've tried setting break points and attaching to the PowerShell commands but this doesn't seem to be working. I've tried both Visual Studio 2013 and 2015.
I am not sure if this will actually classify as an issue, but I think it's worth bringing it up.
It seems that there are 8 commands that have obsolete parameters and are marked with the DontShow attribute.
However, this attribute is available only since PowerShell 4.0, so running the commands (such as New-SPOGroup) will fail in PowerShell 3.0. (btw, I am using the 15.0 version).
Should PowerShell 4.0 be a clear prerequisite stated also in the Readme ?
Exporting SharePoint designer workflows seems to be working. Importing workflows however gives me:
Apply-SPOProvisioningTemplate : Value cannot be null.
Parameter name: input
Is this a known issue or am I doing something wrong?
Hi,
I'm trying to automate some deployments that involve creation and deletion of sites. Imagine the scenario below:
New-SPOWeb -title X -url x -template "STS#0"
New-SPOWeb -title Y -url y -web x -template "STS#0"
New-SPOWeb -title Z -url z -web x/y -template "STS#0"
So my site structure looks something like that:
https://tenant.sharepoint.com/sites/deptest/x
https://tenant.sharepoint.com/sites/deptest/x/y
https://tenant.sharepoint.com/sites/deptest/x/y/z
I want to delete x using Remove-SPOWeb -url x -Force
but that gives the error: There was a problem deleting Web site "/sites/deptest/x". Sites that have subsites or certain apps can't be deleted. Please try again after deleting all subsites and removing the apps.
I tried writing a recursive function to delete to propagate through all the sub webs and delete them.
The real problem I'm having is that I'm not sure how to use Get-SPOSubWebs
to get sub webs at lower levels (lower than 1st level children from site collection). My recursive function below always returns only https://tenant.sharepoint.com/sites/deptest/x
. How do I use it to get to /x/y and /x/y/z?
Here's what I have so far:
Function RemoveWeb()
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[String]$URL,
[Parameter(Mandatory=$false)]
[String]$Web,
[Parameter(Mandatory=$false)]
[Switch]$Recurse
)
if ($Recurse.IsPresent)
{
$subwebs = Get-SPOSubWebs -web ???
foreach($sw in $subwebs)
{
RemoveWeb -URL $sw.Url -Web $Web -Recurse
}
}
$rw = Remove-SPOWeb -Web $Web -Url $URL -Force
}
}
Thanks for all the help
Hello,
is is possible to integrate something like webclient to call any URL (e.g. REST) in SharePoint and use the current credentials/cookies (ADFS)?
Thanks.
Bernd
I'm trying to copy my dev sites to test using the SPOProvisioningTemplate commands. So I'm running something like this:
if ($credentials -eq $null)
{
$credentials=(Get-Credential)
}
Connect-SPOnline -Url https://mytenant.sharepoint.com/sites/Dev -Credentials $credentials
Get-SPOProvisioningTemplate -Out E:\Projects\test.xml
Connect-SPOnline -Url https://mytenant.sharepoint.com/sites/Test -Credentials $credentials
Apply-SPOProvisioningTemplate -Path E:\Projects\test.xml
This all works great however I found quite a lot missing from my Test site. e.g. Pages and web parts on pages are not copied. Is this by design?
The pages are not in the export hence the import will not include the pages. Should I use Get-SPOFile/Add‑SPOPublishingPage/Add‑SPOWebPartToWebPartPage to create my pages?
Hi
I have an issue which I hope you can help with. Basically I cannot get MM fields to display in views if I use XML to deploy a list. The steps I followed are:
The list is present and I can create items including adding MM data. However in the view I cannot see the values stored in the MM fields.
Please let me know if you need any further information.
Thanks
https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/NewSPOTenantSite.md missing required parameter description for the TimeZone parameter
When running the Apply-SPOProvisioningTemplate command the progress bar doesn't disappear. This is a nice feature when things fail half way through during one of the steps. However when all steps completed successfully the progress bar should disappear ( like Write-Progress -Completed ).
This becomes mainly an issue when multiple sites are created using the Apply-SPOProvisioningTemplate command.
Hi,
I'm trying to deploy a WSP to my Office 365 tenant. The manifest.xml file looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="7da4b965-0514-4e14-ae87-a75618ab3e56" SharePointProductVersion="15.0">
<Assemblies>
<Assembly Location="Intranet.dll" DeploymentTarget="GlobalAssemblyCache" />
</Assemblies>
<FeatureManifests>
<FeatureManifest Location="Intranet_.Intranet.Core\Feature.xml" />
<FeatureManifest Location="Intranet_.Intranet.NewsSlider\Feature.xml" />
</FeatureManifests>
</Solution>
When I enter the command Install-SPOSolution -PackageId 7da4b965-0514-4e14-ae87-a75618ab3e56 -SourceFilePath 'Intranet.wsp'
it returns the following error:
Install-SPOSolution : Invalid field name. {33e33eca-7712-4f3d-ab83-6848789fc9b6} /sites/deptest/_catalogs/design
At line:1 char:1
+ Install-SPOSolution -PackageId 7da4b965-0514-4e14-ae87-a75618ab3e56 -SourceFileP ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Install-SPOSolution], ServerException
+ FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.InstallSolution
Where does the 33e33eca-7712-4f3d-ab83-6848789fc9b6
come from? I'm able to deploy the WSP successfully via the UI.
Updating an existing file with Add-SPOFile command and the Checkout option does not work if the library has the Require Checkout -option set. The cmdLet does not even try to checkout the existing file before updating it.
The file exists -check before the actual checkout fails because the necessary property (Exists) is not loaded through CSOM.
I'll submit a pull request to fix this issue.
Hi,
After installing and activating a WSP through the GUI I tried disabling and enabling features as follows but noted that the results are not as expected:
PS C:\Development> Get-SPOFeature -scope site | ? {$_.DefinitionId -eq "45e2ca68-6010-4ca0-b78d-42ca13eec587"}
DefinitionId : 45e2ca68-6010-4ca0-b78d-42ca13eec587
DisplayName : Intranet_.Intranet.Core
Context : Microsoft.SharePoint.Client.ClientContext
Tag :
Path : Microsoft.SharePoint.Client.ObjectPathIdentity
ObjectVersion :
ServerObjectIsNull : False
TypedObject : Microsoft.SharePoint.Client.Feature
After trying to disable it, I was expecting not to see it again.
PS C:\Development> Disable-SPOFeature -Identity "45e2ca68-6010-4ca0-b78d-42ca13eec587" -force
PS C:\Development> Get-SPOFeature -scope site | ? {$_.DefinitionId -eq "45e2ca68-6010-4ca0-b78d-42ca13eec587"}
DefinitionId : 45e2ca68-6010-4ca0-b78d-42ca13eec587
DisplayName : .Intranet_.Intranet.Core
Context : Microsoft.SharePoint.Client.ClientContext
Tag :
Path : Microsoft.SharePoint.Client.ObjectPathIdentity
ObjectVersion :
ServerObjectIsNull : False
TypedObject : Microsoft.SharePoint.Client.Feature
After disabling the feature through the GUI, Get-SPOFeature
did not return anything. Now when I tried re-enabling it, I got the following error:
PS C:\Development> Enable-SPOFeature -Identity 45e2ca68-6010-4ca0-b78d-42ca13eec587 -scope site -Force
Enable-SPOFeature : Feature with Id '45e2ca68-6010-4ca0-b78d-42ca13eec587' is not installed in this farm, and cannot be added to this scope.
At line:1 char:1
+ Enable-SPOFeature -Identity 45e2ca68-6010-4ca0-b78d-42ca13eec587 -scope site -Fo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Enable-SPOFeature], ServerException
+ FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.Features.EnableFeature
Any thoughts?
Thanks,
-Haniel
When installing the powershell cmdlets by using the msi, the PSModulePath is erroneously added to the (old?) wrong location. Which does not make the module available to powershell.
It is set to: "C:\Program Files (x86)\OfficeDevPnP" and should be set to
"C:\Program Files (x86)\OfficeDevPnP.PowerShell.Commands"
Hi,
Is this adressed somwhere here or does it belong to the Core:
pnp/PnP#1121 (comment)
Thanks
Roman
Hi!
When trying to add a wikipage to a site I get an error:
I have tried multiple times with different server relative urls. Is there a problem with the implementation of the Powershell-Commands?
When looking at the docs the only required parameter is -ServerRelativePageUrl https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/AddSPOWikiPage.md
This week something strange happened.
When I add a node on a site and the node url starts with the same as the site url, the command fail.
Example:
On a site with the url: https://mytenant.sharepoint.com/sites/sales,
I run: Add-SPONavigationNode -Url 'https://mytenant.sharepoint.com/sites/sales' -Location TopNavigationBar -Title 'Sales'
Nothing happens and there are no error messages.
If I do this on the rootsite, I get some errors, and no site realted to the root site is added.
All urls starting with https://mytenant.sharepoint.com, will fail.
The error message for the site /sites/sales is:
Add-SPONavigationNode : Cannot open "/sites/sales": no such file or folder.
CategoryInfo : WriteError: (:) [Add-SPONavigationNode], ServerException
+ FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.AddNavigationNode
When exporting a Blog site the following part is generated for the Categories list:
< pnp:ListInstance Title="Categories" Description="Use the Categories list to define the categories available for posts." DocumentTemplate="" TemplateType="303" Url="Lists/Categories" MinorVersionLimit="0" MaxVersionLimit="0" TemplateFeatureID="faf00902-6bab-4583-bd02-84db191801d8" EnableAttachments="false" EnableFolderCreation="false">
< pnp:ContentTypeBindings>
< pnp:ContentTypeBinding ContentTypeID="0x" Default="true" />
< /pnp:ContentTypeBindings>
The content type should be :
0x008DA85C755790C544A7B7FE91EF4D6AD5
Looking at the code in GetProvisioningTemplate.cs in the Core project it looks like the id of the parent is included on each list. For the Categories list this doesn't work and generates an invalid template.
In testing some of the New AzureAD MFA functionality there was a requirement to test connecting to SPO sites.
Using the PowerShell modules this throws an error message as below
PSMessageDetails :
Exception : Microsoft.SharePoint.Client.IdcrlException: The sign-in name or password does not match one in
the Microsoft account system.
at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String securityXml, String
serviceTarget, String servicePolicy)
at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String username, String
password, String serviceTarget, String servicePolicy)
at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.GetAuthenticatio
nCookie(Uri url, String username, SecureString password)
at Microsoft.SharePoint.Client.SharePointOnlineCredentials.GetAuthenticationCookie(Uri url,
Boolean refresh)
at
Microsoft.SharePoint.Client.ClientRuntimeContext.SetupRequestCredential(ClientRuntimeContext
context, HttpWebRequest request)
at Microsoft.SharePoint.Client.SPWebRequestExecutor.GetRequestStream()
at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()
at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRunt
imeContext clientContext, Int32 retryCount, Int32 delay)
at
Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext
clientContext, Int32 retryCount, Int32 delay)
at OfficeDevPnP.PowerShell.Commands.Base.SPOnlineConnectionHelper.InstantiateSPOnlineConnect
ion(Uri url, PSCredential credentials, PSHost host, Boolean currentCredentials, Int32
minimalHealthScore, Int32 retryCount, Int32 retryWait, Int32 requestTimeout, Boolean
skipAdminCheck)
at OfficeDevPnP.PowerShell.Commands.Base.ConnectSPOnline.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject :
CategoryInfo : NotSpecified: (:) [Connect-SPOnline], IdcrlException
FullyQualifiedErrorId : Microsoft.SharePoint.Client.IdcrlException,OfficeDevPnP.PowerShell.Commands.Base.ConnectSPOnlin
e
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
I may be wrong but I'm sure there was a sample for enabling authentication with MFA for the PnP.Core library at some point? Though I may be thinking of ADFS?
Hi,
I installed the PnPPowerShellCommands16.msi however, once installed, none of my normal modules loaded.
I had a look a my env variables and noted the following for PSModulePath:
User:
C:\Users<'myusername'>\AppData\Local\Apps\OfficeDevPnP.PowerShell.Commands
System
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules;
C:\Program Files\Intel;
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement;
C:\Program Files (x86)\SharePoint Online Management Shell;
C:\Program Files\SharePoint Online Management Shell\
I then uninstalled and the same shows as follows:
User:
System:
C:\Users<'myusername'>\Documents\WindowsPowerShell\Modules;
C:\Program Files\WindowsPowerShell\Modules;
C:\Windows\system32\WindowsPowerShell\v1.0\Modules;
C:\Program Files\Intel;
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement;
C:\Program Files (x86)\SharePoint Online Management Shell;
C:\Program Files\SharePoint Online Management Shell\
Note, the top two items were missing when PnP... was installed.
Is this a known problem? Please let me know if you need any other details.
Thanks
John
The Get-SPOWebPartXml seems to not exist (I am trying version 16). Is this available for both 15 and 16 versions of the PowerShell commands?
I couldn't find anything in the following help file:
https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/GetSPOWebPartXml.md
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.