Monday, 25 November 2013

WebPart Page - SP2013


Creating a web part page in SharePoint 2013 is not like a SP2010. Few steps....

 Create a web part page by navigating to “Site Actions”->”Site Settings”



Select “Site Libraries and Lists” from “Site Administration” section



Select “Create new Content” from the page as shown below

                              

Select “Page” from the left panel, select “Web Part Page” option from the right pane and click “Create” button




On the web part creation page, provide page name, select the layout, the library to store the webpart page and click “Create” button.

 


Tip:
    Just enter the Url  http://[server_name]/_layouts/15/mcontent.aspx  
    [server_name] replace server name.


Friday, 27 September 2013

Open PDF documents in Browser Itself - SharePoint Document Library

         Open SharePoint 2010 documents library to open pdf documents in local drive, then how to open those pdf
in browser itself. Lets join a journey with me.................
  SharePoint UI                                 
  •  Central Admin.             
  •   Select WebApplication under Application Management.                      
  •    General Settings.
  •   Default Browser File Handling is Strict. Look like this
 

  •   Change the option Browser File Handling to Permissive.
  •     Perform iisreset and open pdf files in document library.       
    PowerShell

           Using powershell comment to set BrowserFileHandling property.

                Getting library from site.
                                       $web= Get-SPWeb -Identity “SiteUrl”
                                       $library= $web.Lists["LibraryName"]

                Check the BrowserFileHandling.
                            $library.BrowserFileHandling

                Set the value to Permissive
                           $library.BrowserFileHandling = "Permissive"
                           $library.Update()

  Perform iisreset and open pdf files in document library. 

  MIME Type:

            One more option is available to set MIME type, if the above techniques is went wrong,  go ahead this way.............
             
               Getting web application.
                             $curWebApp = Get-SPWebApplication "webappurl"    
  

                Add pdf in MIME type.   
                  $curWebApp.AllowedInlineDownloadedMimeTypes -contains "application/pdf"
                  $curWebApp.Update()

                 Check the PDF type.
                  $curWebApp.AllowedInlineDownloadedMimeTypes -contains "application/pdf"
                  Result : true

  Perform iisreset and open pdf files in document library. 

Thursday, 11 July 2013

Getting list of running services on SharePoint Farm

                   

 Using SharePoint Object Model  to get list of all running services

                Getting what are the services are running in the current SPFarm...........

using System;
using System.Web.UI;
using System.Collections.Generic;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

protected void Page_Load(object sender,EventArgs e)
{
try
            {            
              
                List<string> onLineService = new List<string>();
                List<string> offLineService = new List<string>();
                
               SPFarm farm = SPContext.Current.Site.WebApplication.Farm;             

              // Getting all services in the current Farm
                foreach (SPService service in farm.Services)                   
                {
                   // Getting all  running services using online
                    if (service.Status.Equals(SPObjectStatus.Online))
                    {
                        ListBoxOnLine.Items.Add(service.Name);
                        
                    }
                   // Getting all  running services using offline
                    else if (service.Status.Equals(SPObjectStatus.Offline))
                    {
                        ListBoxOffLine.Add(service.Name);
                    }
                }
            }
            catch (Exception)
            {                
                throw;

            }
}


Thursday, 18 April 2013

SharePoint 2010 List "Add new item" link control appear on the top of the page


SharePoint 2010  List "Add new item" link control  appear on the top of the page


Hi,
     SharePoint list has a large amount of list items, to add a new item  it take time to scroll down the page
     Avoid this try to add Add new item button in top of the page as follows......

     In a sharepoint list page to want to add a button in top                                                                              



 Add a Content Editor Web Part in the List Page

      => To edit the page in site action to add content editor webpart as ......


  => Add a new contents in the content editor web part as......

       Content editor webpart click "Click add new content" link it show the ribbon bar, click  Format text and  HTML to click Edit Html source as.....


 Add a code in the Edit Html Source

 To add piece of code in the edit html source as.....

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
    var mainTable = $("td.ms-addnew").parent().parent().parent().prev();
    var newTable = $("td.ms-addnew").parent().parent().parent();
    newTable.insertBefore(mainTable);
});
</script>




then click ok now add new item button look like this.............



Another Approach:

 sharepoint list page to click on edit page button and edit webpart as...........



To change Tool bar type as Show tool bar as.............

 Then the Tool bar look like this..........