Archivio

Archive for the ‘SharePoint’ Category

Sharepoint – updated Tools

Common (legacy) Tools used for Paltform maintenance and governance:
https://nicolaxanth.wordpress.com/2011/07/22/sharepoint-blog-tools-utili-per-la-gestione-e-la-migrazione-della-farm/

Updated Tools (Sharepoint 2013):

ULS Viewer updated:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=44020

 

Sharepoint – move subsite to a new site collection (and new database)

Sometimes we need to rearrange large size content database into smaller pieces to make each lower than 100 GB (Best Practice)

This is easy enough if we had organize the content in sitecollections, in this case we can move the sitecollection using the powershell command:

Move-SPSite <http://ServerName/Sites/SiteName> -DestinationDatabase <DestinationContentDb>

 

On the other hand the issue requires more effort if we must extract a subsite and create a dedicated Site Collection/DataBase.

Here are some steps and work to be done to achieve the goal:

 

STEP-1: Some assesment and planning occurs first:

-Identify  used Content Types

-Identify used Features

-Identify used Workflows

-(Identify Parent Site Template)

-(Identify Parent Site Language)

 

STEP-2: Create a site collection MySiteColl1 (with a  dedicated DataBase: WSS_Content_MySiteColl1)

 

STEP-3:

-Enable Features

-Enable WorkFlows

-Copy Content Types

This is quite easy using Gary Laponte tool: http://www.falchionconsulting.com/PowerShellViewer/Default.aspx?Version=SP2013&Cmdlet=Copy-SPContentType

 

Example:

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
$siteSRC="http://myintranet/"
$siteDST="http://myintranet/mysitecoll1/"
#
# My Content Types
#
$MyCtype = 'MY_CONTENT_TYPE1'
Copy-SPContentType -SourceContentType $MyCtype -SourceWeb $siteSRC -TargetWeb $siteDST
Write-host "$MyCtype Copied"
...

STEP-4:

(Backup the entire SiteCollection so we have a recovery point just in case of Rollback)

Export Site

STSADM (export/import)

Stsadm - o export -url http://source/mysite1 -includeusersecurity -versions 4 -filename \\backup\mysite1-Backup.bak

 

Powershell  (export/import)

Export-SPWeb http://srv1/mysite1 -includeusersecurity -includeversions All -path \\backup\mysite-Backup.bak

(then rename your Site so  your users are not able to use it anymore)

 

STEP-5:

Import Site

STSADM (export/import)

Stsadm -o import -url http://destination/mysitecoll1/mysite1 -filename \\backup\mysite1-Backup.bak -includeusersecurity

 

Powershell  (export/import)

Import-SPWeb http://destination/mysitecoll1/mysite1 -path \\backup\mysite1-Backup.bak -includeusersecurity

(then create a new Link to the new Site)

 

 

STEP-6:

Delete Old Site.

Pay attention: this operation is not simple as it seems to be if the old site is big enough (more than 20GB)

In my opinion, best way to do it is deleting the old site piece by piece (working on libraries)

Another tip is to turn off the Recycle Bin (just for the time we do this specific maintenance).

RecBin

Categorie:SharePoint Tag:

Sharepoint – Extract Farm Solutions

Powershell script to extract Farm Solutions (.wsp files)

#Add-PSSnapin Microsoft.Sharepoint.Powershell
#
$Folder = “C:\TEMP\mySolutions\”
Set-Location $Folder
#
write-host “download FARM Solutions”
$Farm = Get-SPFarm
foreach(SSol in Get-SPSolution) {
write-host “download Solution:” $Sol.name
$file = $Farm.Solutions.Item($Sol.name).SolutionFile
$file.SaveAs($Folder+$Sol.name)
}
Get-SPSolution > $Folder’ExtractSolution_out.txt’

 

Categorie:SharePoint

SP2010 – Powershell per inserimento Conten Type

#Comando per eseguire le istruzioni Sharepoint/Powershell (da eseguire una sola volta all'inizio)
#Add-PSSnapin microsoft.sharepoint.powershell

# PARAMETRI
#----------- 
#URL del sito 
$parUrl = "http://myServer:12345/"  
$parSite = get-spsite $parUrl

$parWeb = $parsite.openweb() 

# Nome Content Type 
$parctypeName = "Nome Content Type"  
# Gruppo: se non specificato, inserisce nel gruppo di DEFAULT (Custom Content Type), altrimenti specificare il Gruppo (esistente oppure un nuovo gruppo) 
$parCTGroup = "Nuovo Gruppo TEST" 

# Parent del Content Type (Document, Item,...) 
$parParent = "Item" 

# Descrizione del Content Type 
$parDescription = "Descrizione..." 

# ESECUZIONE 
#------------ 
$ctypeParent = $parWeb.availablecontenttypes[$parParent] 

$ctype = new-object Microsoft.SharePoint.SPContentType($ctypeParent, $parWeb.contenttypes, $parctypeName) 

$ctype.Description = $parDescription 
$ctype.Group = $parCTGroup 

# Aggiunge il Content Type 
$parWeb.contenttypes.add($ctype) 

# definisco i campi del Content Type che ho creato 
#$web.fields.add("Campo1", ([Type]"Microsoft.SharePoint.SPFieldType")::Text, $false) 
#$web.fields.add("Campo2", ([Type]"Microsoft.SharePoint.SPFieldType")::Text, $false)
  
# Creo le Site Column e definisco il gruppo (delle site column non del Content Type) in cui inserirle (Inserire il Gruppo esistente oppure il nuovo gruppo) 
$fieldXML1 = '<Field Type="Text" Name="Campo1" Description="Descrizione Campo 1" DisplayName="Campo1" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo1"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML1) 

$fieldXML2 = '<Field Type="Text" Name="Campo2" Description="Descrizione Campo 2" DisplayName="Campo2" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo2"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML2) 

# CHOICE 
$fieldXML3 = '<Field Name="Campo3" Type="Choice" DisplayName="Campo3" Format="RadioButtons" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" FillInChoice="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo3"><Default>Scelta1</Default><CHOICES><CHOICE>Scelta1</CHOICE><CHOICE>Scelta2</CHOICE></CHOICES></Field>'
 
$parWeb.Fields.AddFieldAsXml($fieldXML3) 

# MULTIPLE LINE OF TEXT 
$fieldXML4 = '<Field Type="Note" Name="Campo4" Description="Descrizione Campo 4" DisplayName="Campo4" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" NumLines="6" RichText="FALSE" Sortable="FALSE" StaticName="Campo4"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML4)  
# NUMBER 
$fieldXML5 = '<Field Type="Number" Name="Campo5" Description="Descrizione Campo 5" DisplayName="Campo5" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo5"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML5) 

#DATETIME 
$fieldXML6 = '<Field Type="DateTime" Name="Campo6" Description="Descrizione Campo 6" DisplayName="Campo6" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo6" Format="DateOnly"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML6)  

$field1 = $parWeb.fields.getfield("Campo1") 
$field2 = $parWeb.fields.getfield("Campo2") 
$field3 = $parWeb.fields.getfield("Campo3") 
$field4 = $parWeb.fields.getfield("Campo4") 
$field5 = $parWeb.fields.getfield("Campo5") 
$field6 = $parWeb.fields.getfield("Campo6") 

$fieldLink1 = new-object Microsoft.SharePoint.SPFieldLink($field1) 
$fieldLink2 = new-object Microsoft.SharePoint.SPFieldLink($field2) 
$fieldLink3 = new-object Microsoft.SharePoint.SPFieldLink($field3) 
$fieldLink4 = new-object Microsoft.SharePoint.SPFieldLink($field4) 
$fieldLink5 = new-object Microsoft.SharePoint.SPFieldLink($field5) 
$fieldLink6 = new-object Microsoft.SharePoint.SPFieldLink($field6) 

$ctype.fieldlinks.add($fieldLink1) 
$ctype.fieldlinks.add($fieldLink2) 
$ctype.fieldlinks.add($fieldLink3) 
$ctype.fieldlinks.add($fieldLink4) 
$ctype.fieldlinks.add($fieldLink5) 
$ctype.fieldlinks.add($fieldLink6)   
$ctype.Update() 

$parWeb.Dispose() 

$parSite.Dispose() 
Categorie:SharePoint

SP2010 – Overview RBS (Remote Blob Storage)

 Sharepoint 2010 e SQL Server

Schema Architettura



STEP Configurazione RBS

 Step SQL SERVER Sharepoint 2010 WFE NOTE
1 ENABLE AND CHANGE FILESTREAM SETTINGS A livello di istanza

 
2 PROVISION A BLOB STORE WITH THE FILESTREAM PROVIDER Per <ContentDbName>

Su disco del server DB

3 INSTALL RBS (on all WFE)

ENABLE AND TEST RBS (powershell)
Per <ContentDbName>
4 Migrate Existing Documents from the Database to the Remote Blob Store

(powershell)

Da DB


SP2010 – Check Sharepoint Farm: PowerShell instructions (.ps1)

15/02/2013 Commenti disabilitati

#Add-PSSnapin Microsoft.SharePoint.PowerShell

# Identify BUILD VERSION

get-spfarm | select BuildVersion

# Check SKU (Sharepoint Edition)

get-spfarm | select Products | ft -auto

# GUIDs delle SKU:

# —————-

# BEED1F75-C398-4447-AEF1-E66E1F0DF91E: SharePoint Foundation 2010

# 1328E89E-7EC8-4F7E-809E-7E945796E511: Search Server Express 2010

# B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0: SharePoint Server 2010 Standard Trial

# 3FDFBCC8-B3E4-4482-91FA-122C6432805C: SharePoint Server 2010 Standard

# 88BED06D-8C6B-4E62-AB01-546D6005FE97: SharePoint Server 2010 Enterprise Trial

# D5595F62-449B-4061-B0B2-0CBAD410BB51: SharePoint Server 2010 Enterprise

# BC4C1C97-9013-4033-A0DD-9DC9E6D6C887: Search Server 2010 Trial

# 08460AA2-A176-442C-BDCA-26928704D80B: Search Server 2010

# 84902853-59F6-4B20-BC7C-DE4F419FEFAD: Project Server 2010 Trial

# ED21638F-97FF-4A65-AD9B-6889B93065E2: Project Server 2010

# 926E4E17-087B-47D1-8BD7-91A394BC6196: Office Web Companions 2010

# Cehck Site Collections SIZE

Get-SPSite -Limit All | select url, @{label=”Size in KB”;Expression={$_.usage.storage}} | Format-Table -AutoSize | out-string -width 2048

# List All Farm Solutions

Get-SPSolution

Categorie:SharePoint Tag:,

SP2010 – Installazione e Rimozione Farm Solution

Installazione Farm Solution

L’installazione di una farm solution agisce su più livelli

  • Web Application BIN folder
  • Global Assembly Cache (GAC)
  • The Solution Hive

La solution una volta installata può richiedere l’abilitazione di Feature (l’ambito della Feature dipende dalla Solution e dalle sue caratteristiche by design, ovvero la dipendenza è legata all’ambito di azione: Web Application, Site Collection, WebSite )
Esempio Solution: Sogeti.SharePoint.WarmUp.wsp

(http://sharepointwarmup.codeplex.com/)

#POWERSHELL:

#———–

# Carica Powershell snap-in di Sharepoint

#add-pssnapin microsoft.sharepoint.powershell

# Install Solution

#—————–

Add-SPSolution “C:\TEMP\TOOLS\SP2010-WarmUp_CODEPLEX\Sogeti.SharePoint.WarmUp.wsp”

Install-SPSolution -Identity Sogeti.SharePoint.WarmUp.wsp -GACDeployment

Verifica della GAC using Explorer: %windir%\assembly (C:\windows\assembly)


Esempio Abilitazione Feature: Sogeti.SharePoint.WarmUp.wsp (ambito Web Application)

CENTRAL ADMIN

Application Management > (scelta della Web Application) > Manage Features



Rimozione (Uninstall) di una Farm Solution

ATTENZIONE: La Best Practice per la Rimozione delle Features prevede di fare esattamente gli stessi passi dell’installazione partendo dalla fine:

  • Disattivazione Features Attivate (per evitare di creare dei riferimenti “orfani”)
  • Uninstall della solution (rimuove l’assembly)
  • Rimozione del pacchetto

#POWERSHELL:

#———–

# Carica Powershell snap-in di Sharepoint

#add-pssnapin microsoft.sharepoint.powershell

# UnInstall Solution

#——————-

Uninstall-SPSolution -Identity Sogeti.SharePoint.WarmUp.wsp

Remove-SPSolution -Identity Sogeti.SharePoint.WarmUp.wsp

Categorie:SharePoint Tag: