Posts

Get Current Year From Created by Column

=IF([Created]="","",""&YEAR([Created]))

Get multiple users into a array of single SPListItem

string [] delimit = new string [] { ";#" }; DataRow dr = dt.NewRow(); string [] stringarray = item[ "TargetAudience" ].ToString().Split((delimit), StringSplitOptions .RemoveEmptyEntries); StringBuilder sb = new StringBuilder (); for ( int i = 0; i < stringarray.Length; i++) {     if (i % 2 != 0)     {         sb.Append(stringarray[i].ToString()+ "," );     } }

Remove last letter from the stirng Ex: test1, test2, test3, ß--- it willremove the last comma of the string

myString = myString . substr ( 0 , myString . length - 1 ) + '.' ;

It Gives mail to functionality if we click on the link it will automatically opens the send mail box

<a href=mailto:' + empEmailId + '>' + empEmailId + '</a>

Deployment Commands

Backup-SPSite -Identity "http://uscin2012v3:1234/sites/dev/" -Path "C:\Working\26thNov2014\cp.bak" -NoSiteLock Restore-SPSite -Identity "http://uscin2012v3:1234/sites/dev/" -Path "C:\Anil\25thFeb2015\cp.bak" Restore-SPSite http://uscin2012v3:1234/sites/dev1/ -Path C:\Anil\25thFeb2015\cp.bak

This url gives the list of wsp deployed in that site collection, if you dnt have CM this is way to know your wsp

http://uscin2012v3:5555/_catalogs/wp/Forms/AllItems.aspx

It gives the hidden users list in that particular site collection

http://uscin2012v3:5555/_catalogs/users/simple.aspx