Wednesday, February 18, 2015

Powershell : Get count of site collections in Webapplication



param($Site,$FilePath)
   
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
   
function GenerateAllSitecollectionsCountInWebapplication ($url)
{
    write-host "Extracting the count of site collections in web application....." -foregroundcolor black
    try
      {
         $Site=Get-SPSite $url        
         $spWebApp = $Site.WebApplication
         write-host Total count in $url is   $Site.WebApplication.Sites.Count -foregroundcolor red
      }
   catch
      {
          write-host "Unable to Extract Sitecollection count .."  -foregroundcolor red
          break
      }
GenerateAllSitecollectionsCountInWebapplication -Url "www.yoursite.com"


Microsoft Azure

Azure...
http://azure.microsoft.com/en-us/



Tuesday, February 17, 2015

Set Default Look up value for Look up column SharePoint 2010 list

 Copy and paste the following script.<script language="ecmascript" type="text/ecmascript"> 
        var fieldCollection;
        var field;
        var list;
        function fieldDefaultValue() {
            var clientContext = SP.ClientContext.get_current();
            if (clientContext != undefined && clientContext != null) {
                var webSite = clientContext.get_web();
                this.list = webSite.get_lists().getByTitle("List Request");
                this.fieldCollection = list.get_fields();
                this.field = fieldCollection.getByTitle("Description");
                this
.field.set_defaultValue("Default");                this.field.update();                clientContext.load(this.field);
                clientContext.executeQueryAsync(Function.createDelegate(thisthis.OnLoadSuccess),
Function.createDelegate(thisthis.OnLoadFailed));
            }
        } 
        function OnLoadSuccess(sender, args) {
            
alert(this.field.get_defaultValue());        } 
        function OnLoadFailed(sender, args) {
            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        }
</
script
>    <input id="btnFieldDefaultValue" onclick="fieldDefaultValue()" type="button" value="Field Default Value" />