Friday, 18 September 2015

SharePoint Services Stopped working

We can solve this issue by managing manage account.


There are two ways to solve this issue:


Interface- Open central administration >> System Security >> Managed account >> Set new password there.


PowerShell:


Set-ManagedAccount "Domain\Sp_farm"

"Add a page" option missing under gear "Site Action Menu" in SharePoint

#"Add a page" option missing under gear "Site Action Menu" in SharePoint Blank Site template-:
Blank sites web template do not offer "Add a page" option in SharePoint where as other site template offer this option.
In order to add this option under "Site Action Menu" gear, we have to activate the publishing feature on the Site collection and site respectively.

Saturday, 11 July 2015

Hide tabs on site

under CSS file
set display property to NONE instead of instead of INLINE.

Tuesday, 7 July 2015

REF Cursor vs cursor

A cursor is really any SQL statement that runs DML (select, insert, update, delete) on your database.
A ref cursor is a pointer to a result set. This is normally used to open a query on the database server, then leave it up to the client to fetch the result it needs. A ref cursor is also a cursor, though normally the term cursor is used when discussing static SQL.




create or replace
function f (input in varchar2)
return sys_refcursor as cur sys_refcursor;
begin
if input = 'EMP' then
open cur for select * from emp;
elsif input = 'DEPT' then
    open cur for select * from dept;
  end if;
return cur;
end;



Powershell Get Size SharePoint Sites or Webs

param(
[Parameter(Mandatory = $true, ValurFromPipelineByPropertyName=$true) ][System.String] $env,
[Parameter(Mandatory= $true, ValueFromPipelineByPropertyName = $true)][System.String] $outputFile
)

$snapin = Get_PSSnapin | Where-Object{$_.Name -eq "Microsoft.SharePoint.PowerShell"}
if($snapin -eq $null)
{
Write-Host "Adding SharePoint Snapin..."
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

$table = New-Object System.Data.DataTable "WebSite Size Table"
$title = New-Object System.Data.DataTable Title,([system.string])
$url = New-Object System.Data.DataTable URL, ([system.string])
$size = New-Object System.Data.DataTable size, ([system.string])
$table.Columns.Add($title)
$table.Columns.Add($url)
$table.Columns.Add($size)

function GetSpWebSize($Web)
{
 [long]$subtotal = 0
    foreach ($folder in $Web.Folders)
    {
        $subtotal += GetFolderSize -Folder $folder
    }
  
    return $subtota
}

function GetSubWebSizes ($Web)
{
    [long]$subtotal = 0
    foreach ($subweb in $Web)
    {
        [long]$webtotal = 0
        foreach ($folder in $subweb.Folders)
        {
            $webtotal += GetFolderSize -Folder $folder
        }
       
        $subtotal += $webtotal
       
    }
    return $subtotal
}

function GetFolderSize ($Folder)
{
    [long]$folderSize = 0 
    foreach ($file in $Folder.Files)
    {
        $folderSize += $file.Length;
    }
    foreach ($fd in $Folder.SubFolders)
    {
        $folderSize += GetFolderSize -Folder $fd
    }
    return $folderSize
}


if($env  -eq "QA")
{
 $File = "AllQASites.csv"
}
elseif($env -eq "Live")
{
 $File = "AllLiveSites.csv"
}
else
{
Write-Host "Please  choose the environment either QA or Live!"
return
}

$getContent = Import-Csv -path $File

Foreach($rowin in $getContent)
{
  Write-Host "Fetching details of " $rowin.Site -ForegroundColor Green
if($rowin.Type -eq "Site")
{
 $WebSite = Get-SPSite -Identity $rowin.URL -ErrorAction SilentlyContinue
}
elseif($rowin.Type -eq "Web")
{
$WebSite = Get-SPWeb -Identity $rowin.URL -ErrorAction SilentlyContinue
}
else
{
Write-Host "Please choose type either Site or web!"
return
}
try{
if($WebSite -ne $null)
{
 $row = $table.NewRow()
if($rowin.Type -eq "Site")
{
 $row.Title = $WebSite.RootWeb.Title
$row.URL = $WebSite.URL
$row.size = $WebSite.usage.storage/1MB
}
else if($rowin.Type -eq "Web")
{
 $row.Title = $WebSite.Title
$row.URL = $WebSite.URL

[long]$total = 0

$total += GetSPWebSize -Web $WebSite.URL
$total += GetSubWebSizes -Web $site.Url

            $Folder = $site.Folders
            foreach ($file in $Folder.Files)
            {
                $total += $file.Length;
            }
            foreach ($fd in $Folder.SubFolders)
            {
        $total += GetFolderSize -Folder $fd
                }

$row.size = ($total/1024)/1024
}
$table.Rows.Add($row)
$table.AcceptChanges()
$WebSite.Dispose()
}
}
Catch{
 Write-Host $_.Exception.Message -ForegroundColor Red
}
}

$table | Export-Csv -Path $outputFilePath -NoTypeInformation

$endDate = Get-Date
Write-Host "script completed at" $endDate -ForegroundColor Yellow


#Please write your queries on "Arpit_Mohan@outlook.com"

Monday, 6 July 2015

Response File CSC.rsp

Response file is text file which consists of a set of command line switches.


And the switches were user by CSC.exe compiler.



# Reference the common Framework libraries
/r:Accessibility.dll
/r:Microsoft.CSharp.dll
/r:System.Configuration.dll
/r:System.Configuration.Install.dll
/r:System.Core.dll
/r:System.Data.dll
/r:System.Data.DataSetExtensions.dll
/r:System.Data.Linq.dll
/r:System.Data.OracleClient.dll
/r:System.Deployment.dll
/r:System.Design.dll
/r:System.DirectoryServices.dll
/r:System.dll
/r:System.Drawing.Design.dll
/r:System.Drawing.dll
/r:System.EnterpriseServices.dll
/r:System.Management.dll
/r:System.Messaging.dll
/r:System.Runtime.Remoting.dll
/r:System.Runtime.Serialization.dll
/r:System.Runtime.Serialization.Formatters.Soap.dll
/r:System.Security.dll
/r:System.ServiceModel.dll
/r:System.ServiceModel.Web.dll
/r:System.ServiceProcess.dll
/r:System.Transactions.dll
/r:System.Web.dll
/r:System.Web.Extensions.Design.dll
/r:System.Web.Extensions.dll
/r:System.Web.Mobile.dll
/r:System.Web.RegularExpressions.dll
/r:System.Web.Services.dll
/r:System.Windows.Forms.Dll
/r:System.Workflow.Activities.dll
/r:System.Workflow.ComponentModel.dll
/r:System.Workflow.Runtime.dll
/r:System.Xml.dll
/r:System.Xml.Linq.dll

This Web Site Cannot be Started. Another Web Site May Be Using the Same Port

Open the IIS.
Check all the websites port.
Surely you will get same for two websites.
Resolution:
1) Stop any of the website, which you don't want to use.
2) Change the port number for any of the website. Go to Advance Settings and change the port number