Tuesday, March 27, 2018

SharePoint column validation formula for time value - input in a single line of text field.

Here is a Column validation formulas for time value only input in a single line of text field:


Formula for hours, minutes and seconds(e.g.02:30:00):

=AND(TIMEVALUE(FieldName)<>TEXT(FieldName,"HH:MM:SS"),LEN(FieldName)=8)

 Formula for hours and minutes(e.g.02:30):

=AND(TIMEVALUE(FieldName)<>TEXT(FieldName,"HH:MM"),LEN(FieldName)=5)










Tuesday, March 13, 2018

Change certificate - Office Web Apps

Certificate has been expired and now we need to configure new certificate for existing web farm.
How to change office web apps certificate with powershell?


Before PowerShell command import certifikate in Personal Certifikate Store.


Open a Microsoft PowerShell window as Administrator.

Set-OfficeWebappsFarm -CertificateName "CertifikateFriendlyName"


After this command server restart is required.

Wednesday, March 7, 2018

Get number of subsite in a site collection - SharePoint

How to get number of subsites in a site collection using Powershell?
 
 
 
 
$site = Get-SPSite http://YourSharePointSite
$site.AllWebs.Count
 
 
 
 

Get number of all files on SharePoint farm

How to get number of all files in libraries in SharePoint farm


Add-PSSnapin Microsoft.SharePoint.PowerShell
Start-SPAssignment -Global
$OutputFile = “C:\Temp\DocCount.csv”
$results = @()
$webApps = Get-SPWebApplication
foreach($webApp in $webApps)
{
    foreach($siteColl in $webApp.Sites)
    {
        foreach($web in $siteColl.AllWebs)
        {
            $webUrl = $web.url
            $docLibs = $web.Lists | Where-Object {$_.baseType -eq “DocumentLibrary”}
            $docLibs | Add-Member -MemberType ScriptProperty -Name WebUrl -Value {$webUrl}
            $results += ($docLibs | Select-Object -Property WebUrl, Title, ItemCount)
        }
    }
}
$results | Export-Csv -Path $OutputFile -NoTypeInformation
   
Stop-SPAssignment -Global