Export-SPWeb script to get backup all lists and libraries

Posted Yorum yapınSharePoint 2010, Sharepoint 2013 içinde yayınlandı

Wrote this Powershell script according to my company’s needs,but you can fork and use it if you like

Export-SPWeb Script to get backup of all lists/libraries in a site collection.

But I’ll also share it here:

[code language=”powershell”]
Add-PSSnapin Microsoft.Sharepoint.Powershell

$site = Get-SPSite
$path = "C:\Backup2015\ListBackups"
$serverurlpath =""
$listurlpath=""
$listurlwithoutformat=""
$dosyapath =""
$itemURLNEW=""

foreach($web in $site.AllWebs){
$serverurlpath=$web.Url
$serverlistsurlpath=$web.ServerRelativeUrl -replace "/","\"
$serverurlport = ([System.Uri]$serverurlpath).Port
$serverurlhost = ([System.Uri]$serverurlpath).Host.Split(‘.-‘) -join "_"

if($serverurlport -eq "80")
{
if(!(Test-Path -Path ($path + "\" + $serverurlport)))
{
New-Item -Path ($path + "\" + $serverurlport) -Type Directory
}

if(!(Test-Path -Path (($path + "\" + $serverurlport + "\" + $serverurlhost))))
{
New-Item -Path ($path + "\" + $serverurlport + "\" + $serverurlhost) -Type Directory
}

foreach($list in $web.lists)
{

If (!(Test-Path ($path + "\" + $serverurlport + "\" + $serverurlhost + $serverlistsurlpath))) {
New-Item -Path ($path + "\" + $serverurlport + "\" + $serverurlhost + $serverlistsurlpath) -Type Directory
}

$itemURLNEW= "$($list.RootFolder.ServerRelativeUrl)"
if($serverlistsurlpath -eq "\")
{
$dosyapath = "$path\$($serverurlport)\$($serverurlhost)$($serverlistsurlpath)$($list -replace "/","\").cmp"
}

else
{
$dosyapath = "$path\$($serverurlport)\$($serverurlhost)$($serverlistsurlpath)\$($list-replace "/","\").cmp"
}

if(!(Test-Path ($dosyapath)) -and $list.Hidden -eq $false)
{
export-spweb $web.URL -ItemUrl $itemURLNEW -IncludeUserSecurity -IncludeVersions All -path "$dosyapath" -nologfile
}
}
}

if($serverurlport -eq "1111")
{
if(!(Test-Path -Path ($path + "\" + $serverurlport)))
{
New-Item -Path ($path + "\" + $serverurlport) -Type Directory
}

if(!(Test-Path -Path (($path + "\" + $serverurlport + "\" + $serverurlhost))))
{
New-Item -Path ($path + "\" + $serverurlport + "\" + $serverurlhost) -Type Directory
}

foreach($list in $web.lists)
{

If (!(Test-Path ($path + "\" + $serverurlport + "\" + $serverurlhost + $serverlistsurlpath))) {
New-Item -Path ($path + "\" + $serverurlport + "\" + $serverurlhost + $serverlistsurlpath) -Type Directory
}

$itemURLNEW= "$($list.RootFolder.ServerRelativeUrl)"

if($serverlistsurlpath -eq "\")
{
$dosyapath = "$path\$($serverurlport)\$($serverurlhost)$($serverlistsurlpath)$($list -replace "/","\").cmp"
}

else
{
$dosyapath = "$path\$($serverurlport)\$($serverurlhost)$($serverlistsurlpath)\$($list -replace "/","\").cmp"
}

if(!(Test-Path ($dosyapath)) -and $list.Hidden -eq $false)
{
export-spweb $web.URL -ItemUrl $itemURLNEW -IncludeUserSecurity -IncludeVersions All -path "$dosyapath" -nologfile
}
}
}
}
[/code]

SharePoint 2010 Deployment Problem: Error occurred in deployment step ‘Retract Solution’

Posted Yorum yapınSharePoint 2010 içinde yayınlandı

Today while i was working on a SharePoint 2010 project,i came across this problem:

“Error occurred in deployment step ‘Retract Solution’: C:\Windows\Temp\{some guid with packagename}.wsp could not be created because the contents could not be found under id {some guid} in the configuration database.

I was trying to figure out what the problem might be then i realized it was my fault :))

I stopped SharePoint 2010 Timer service before deploying.So starting the Timer Service from services.msc resolved my problem.