clear
Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.Powershell
####################### ENVIRONMENT VARIABLES #######################
$contentTypeSourceWeb = "http://webapp/sites/contenttypehub" #Site Collecton
# The exported content type is stored in the XML file
$xmlFilePathForContentType = "C:\Script-SiteContentTypes.xml"
#####################################################################
#Content Type group you are looking to export
$contentTypeGroupName = "Custom Content Types"
$sourceWeb = Get-SPWeb $contentTypeSourceWeb
#Create Export File
New-Item $xmlFilePathForContentType -type file -force
#Export Content Types to XML file
Add-Content $xmlFilePathForContentType "<?xml version=`"1.0`" encoding=`"utf-8`"?>"
Add-Content $xmlFilePathForContentType "`n<ContentTypes>"
$sourceWeb.ContentTypes | ForEach-Object {
if ($_.Group -eq $contentTypeGroupName) {
write-host "Adding content type to file."
Add-Content $xmlFilePathForContentType $_.SchemaXml
}
}
Add-Content $xmlFilePathForContentType "</ContentTypes>"
$sourceWeb.Dispose()
write-host "Completed"
Thursday, January 11, 2018
Export Content Types using PowerShell - SharePoint
Subscribe to:
Post Comments (Atom)
Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular
Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...
-
We had an issue while updating the datafield values without executing the action in the application form. If we use ProcessInstance Updat...
-
Trying to use the Oracle Data Provider for .NET ( ODP.NET ) with Entity Framework (EF) results in the following error: System.Data.Pro...
-
Issue: LDAP Query not pulling all the Active Directory Groups (including subgroups) available in the given domain. Solution: To retriev...
No comments:
Post a Comment