<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sharepoint powershell commands &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/sharepoint-powershell-commands/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Tue, 24 Aug 2021 17:21:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>sharepoint powershell commands &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>SharePoint PnP Provisioning with Data &#8211; Move Your Contents from One Site to Another in SharePoint Online</title>
		<link>https://mail.sibeeshpassion.com/sharepoint-pnp-provisioning-with-data-move-your-contents-from-one-site-to-another-in-sharepoint-online/</link>
					<comments>https://mail.sibeeshpassion.com/sharepoint-pnp-provisioning-with-data-move-your-contents-from-one-site-to-another-in-sharepoint-online/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 06 Nov 2018 16:18:36 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[move data between sites in sharepoint]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint pnp provisioning]]></category>
		<category><![CDATA[sharepoint powershell commands]]></category>
		<category><![CDATA[SharePoint Tips]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=13341</guid>

					<description><![CDATA[[toc] Introduction I understand that you need to move all of your contents to your destination site from your source site in SharePoint online. You might have done some search in Google and saw this post. Here in this article, I will be walking you through the steps you need to perform the SharePoint PnP provisioning. With the latest SharePoint modern experience, Microsoft had decided to turn off some features, and one among them was Custom Scripting. Unfortunately, to do the SharePoint provisioning, we will have to enable the Custom Scripting. Enough talking, let&#8217;s jump into the coding. I hope you will find [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h2>Introduction</h2>
<p>I understand that you need to move all of your contents to your destination site from your source site in <a href="https://sibeeshpassion.com/category/sharepoint/">SharePoint</a> online. You might have done some search in Google and saw this post. Here in this article, I will be walking you through the steps you need to perform the SharePoint PnP provisioning. With the latest SharePoint modern experience, Microsoft had decided to turn off some features, and one among them was Custom Scripting. Unfortunately, to do the SharePoint provisioning, we will have to enable the Custom Scripting. Enough talking, let&#8217;s jump into the coding. I hope you will find this post useful.</p>
<h2>Before you start Provisioning your site</h2>
<p>Before you jump into the process of provisioning there is some configuration which you must perform.</p>
<ul>
<li>Enable the Custom Scripting</li>
<li>Set the User as a Term Store Admin</li>
</ul>
<h3>Enable the Custom Scripting</h3>
<p>With the latest release, Microsoft had deactivated this feature from the modern SharePoint experience thus we would have to enable it manually. According to Microsoft, below are the features which will not be available until you manually enable the custom scripting.</p>
<ol>
<li>Save Site as Template</li>
<li>Save document library as template</li>
<li>Solution Gallery</li>
<li>Theme Gallery</li>
<li>Help Settings</li>
<li>HTML Field Security</li>
<li>Sandbox solutions</li>
<li>SharePoint Designer</li>
<li>Uploading files that potentially include script</li>
</ol>
<p>In our case, we wanted to do SharePoint PnP provisioning, and it is interesting that it is not mentioned anywhere that we need to enable custom scripting to do SharePoint PnP provisioning. You can always enable the Custom Scripting in two ways, one is using the portal, and another is to use PowerShell commands. I would prefer using the PowerShell commands as it will enable the custom scripting right away. If you enable the custom scripting via the portal, it will take 24 hours to get it activated.</p>
<p id="to-allow-custom-script-on-other-sharepoint-site-collections" class="heading-with-anchor">To allow custom script on other SharePoint site collections, you will have to download the download the latest SharePoint Online Management Shell. Once you are done you can perform the below commands.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Connect-SPOService -Url https://yoursharepoint-admin.sharepoint.com</pre>
<p>The above command will connect your SharePoint admin site, please be noted that you should have a tenant admin access to do this. If you don&#8217;t have the access, you should consider getting the access or you can request the tenant admin to do the same.</p>
<p>Once you are connected, you can perform the preceding command.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Set-SPOsite https://yoursharepinttenant.sharepoint.com/sites/yoursharepointsite -DenyAddAndCustomizePages 0
</pre>
<p>The above command will enable the custom scripting for the site you have mentioned. To check this, you can always go to any of your site collection/list settings, and if you see the option save the list as a template, it is done and you can proceed.</p>
<div id="attachment_13342" style="width: 288px" class="wp-caption aligncenter"><a href="https://sibeeshpassion.com/wp-content/uploads/2018/11/Save-list-as-template.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-13342" class="size-full wp-image-13342" src="https://sibeeshpassion.com/wp-content/uploads/2018/11/Save-list-as-template.png" alt="Save list as template" width="278" height="300" /></a><p id="caption-attachment-13342" class="wp-caption-text">Save list as the template</p></div>
<h3>Set the User as a Term Store Admin</h3>
<p>Once we have enabled the custom scripting it is time to add you as the Term Store Admin, again you can always reach out to your Tenant admin to add you as a Term Store Admin. You can ask your Tenant admin to perform the preceding steps.</p>
<ol>
<li>
<p class="">Sign in to Office 365 as a global admin or SharePoint admin.</p>
</li>
<li>Click on the app launch icon( 9 dots) and then click on Admin to open the Microsoft 365 admin center.</li>
<li>Select Admin centers and then click on SharePoint.</li>
<li>Now, you should see an option as Term Store and click on it.</li>
<li>He/She can add your mail id in the text box near to the heading Term Store Administrators</li>
</ol>
<p>Once it is done you can always go to your Site Settings &gt; Term Store Management &gt; Term Store Administrators.</p>
<h2>Start SharePoint PnP Provisioning</h2>
<p>Wow!. We have done all the configuration and now we can start doing the provisioning.</p>
<h3>Connect your source site</h3>
<p>The first thing to do is, to connect the source SharePoint site, you can do that by using the preceding command.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Connect-PnPOnline https://youradmin.sharepoint.com/sites/yoursite/</pre>
<h3>Generate a provisioning template</h3>
<p>Now we can generate a provisioning template from the web. You can do that by doing the command below.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Get-PnPProvisioningTemplate -Out c:/Provisioning/template.xml</pre>
<p>Please be noted that this will create a new folder &#8220;Provisioning&#8221; in the C drive and then place the template.xml in it. You can always see the other options of Get-Pn<wbr />PProvisioning<wbr />Template <a href="https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/get-pnpprovisioningtemplate?view=sharepoint-ps">here.</a> This command will pull almost everything from the source site, and you can always choose what exactly you need to take from the source site. <strong>This will not retrieve the data, you will have to use another command for that</strong>.</p>
<h3>Add data to the provisioning template</h3>
<p>As we have seen that the Get-Pn<wbr />PProvisioning<wbr />Template will not retrieve the data with the list, we will have to use Add-Pn<wbr />PData<wbr />Rows<wbr />ToProvisioning<wbr />Template command to do that magic.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Add-PnPDataRowsToProvisioningTemplate -Path c:/Provisioning/template.xml -List 'The list name' -Query '&lt;view&gt;&lt;/view&gt;'</pre>
<p>Please see <a href="https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpdatarowstoprovisioningtemplate?view=sharepoint-ps">here</a> to see the other options you can use with the Add-Pn<wbr />PData<wbr />Rows<wbr />ToProvisioning<wbr />Template command. Please be noted that the size of the template.xml file will be larger as per the data you have in the source list.</p>
<h3>Apply provision to your destination site</h3>
<p>Now we have an XML file which has everything we need to move. Let&#8217;s just do it then. Connect your destination site by following the command below.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Connect-PnPOnline https://youradmin.sharepoint.com/sites/yourdetinationsite</pre>
<p>Please remember to use the same id and password of your Term Store Admin account.</p>
<p>Once you are connected to the destination site, you can perform the Apply-PnPProvisioningTemplate as follows.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Apply-PnPProvisioningTemplate -Path C:/Provisioning/template.xml</pre>
<p>If you are getting an error as &#8221; Apply-PnPProvisioningTemplate : The parent content type specified by content type identifier does not exist&#8221;, you will have to enable the <strong>SharePoint Server Publishing feature</strong> in the Site Settings &gt; Site Features. Remember to enable the <strong>SharePoint Server Publishing Infrastructure</strong> under Site Settings &gt; Site Collection Features before you enable the SharePoint Server Publishing feature in the Site Settings. It is a dependency. You can always see my StackExchange answer <a href="https://sharepoint.stackexchange.com/questions/154239/the-parent-content-type-specified-by-content-type-identifier-ct-id-does-not-ex/251856#251856">here</a>.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Apply-PnPProvisioningTemplate : The parent content type specified by content type identifier does not exist.
At line:1 char:1
+ Apply-PnPProvisioningTemplate -Path C:\Provisioning\template.xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate
</pre>
<p>Please be noted that you will also get an error as &#8220;WARNING: ListInstance Style Library is a Style Library of a site with NoScript enabled and will be skipped&#8221; if the custom scripting is not enabled.</p>
<p>You will also get an error as &#8220;Access denied. You do not have permission to perform this action or access this resource&#8221; if you don&#8217;t have Term Store Admin permission.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Apply-PnPProvisioningTemplate : Access denied. You do not have permission to perform this action or access this resource.
At line:1 char:1
+ Apply-PnPProvisioningTemplate -Path C:/Provisioning/template.xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerUnauthorizedAccessException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate
</pre>
<p>Once you run the Apply-PnPProvisioningTemplate command, and if everything is fine, you will get everything in your destination site. It will take some time to generate everything for you and add the data to it, depends on the amount of the data you have the process can take from 5 minutes to hours.</p>
<h2><span id="conclusion_1"><span id="conclusion">Conclusion</span></span></h2>
<p>Congratulation, we have successfully moved all of our data and almost everything from one SharePoint site to other. In this article, we have learned how to,</p>
<ol>
<li>Enable Custom Scripting in SharePoint</li>
<li>Add a Term Site Admin</li>
<li>Connect to a SharePoint site</li>
<li>Create a PnP provisioning template from the web</li>
<li>Add data to your Provisioning template form the lists</li>
<li>Apply the provisioning to the destination SharePoint site</li>
</ol>
<h2><span id="your-turn-what-do-you-think">Your turn. What do you think?</span></h2>
<p>Thanks a lot for reading. I will come back with another post on the same topic very soon. Did I miss anything that you may think which is needed? Could you find this post as useful? Kindly do not forget to share me your feedback.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/sharepoint-pnp-provisioning-with-data-move-your-contents-from-one-site-to-another-in-sharepoint-online/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
