SharePoint4us

Explore the Experience in SharePoint 2013

Thursday, October 30, 2014

Drag and drop webpart functioanilty not saving changes in SharePoint 2010 with IE9

No comments
If you are building a custom master page, and you happen to include a line that looks like this:
<meta http-equiv="X-UA-Compatible" content="IE=9"> 
The web part manager on the page may not actually save changes made when dragging and dropping web parts to different zones.   This is because SharePoint 2010 has known limitations with IE9:

1) Dragging and dropping of web parts no longer works.
2) The tooltips for the ribbon buttons have a double border that displays awkwardly for the bottom and right side

Make sure to follow what is provided in the existing v4.master;

<meta http-equiv="X-UA-Compatible" content="IE=8">
IE=8 vs IE=9.
On a further note:
The only browsers fully supported by SharePoint 2010 are IE 7 and IE 8.
IE 9/10, Chrome, FireFox are supported with known issues.
IE 6 is definitely -not- supported.  The main reason is due to the way the master page encapsulates content in a scrolling div, as well as many other java script and CSS related items that were introduced in the new specifications.

Wednesday, October 29, 2014

How to Create a Site Collection in SharePoint 2013

2 comments

Hi Friends,

Thanks for visiting my blog .Hope this post will help you
If you like my post please Share your Ideas.


In this Post I will let  you know creation of Site Collection .
SharePoint 2013,2010, we can create multiple site collections to a web application .

Site Collection : 
A site collection is a group of Web sites that have the same owner and share administration settings, for example, permissions. When you create a site collection, a top-level site is automatically created in the site collection. You can then create one or more sub sites below the top-level site. 

In SharePoint we can create a site collection in many ways 
1. Out of Box 
2. Programmatically (SOM ).
3. Power Shell.
4. Client Object Model (CSOM).

In this Post i will show you , how to create a site  collection through out of Box feature.

Note : Whenever we create any new web application via out of box we definitely create a site collection as Top- Level Site .  

In Case if you need to create a new site collection for your web application .

 Please  follow  the below step by step procedure for creating SharePoint Collection .

 Open Central Administration  :

In Central Administration page . we can create Site Collection in two ways .
 1. Direct link available under manage web applications.
 2. Click on Application Management link  available at left side of page.

Click on Create Site Collection --> Select the web application URL ( Site Collection target ).



        Here we need to select the web application in which we are targeting our site collection.
 


Template Selection :
We can select one of the available templates provided by the SharePoint . We can also create our own templates.

Site Collection Administrators :
We  can provide  max two site collection administrators.


 After selecting the site collection administrators. please select OK button.


Within few seconds we can able to see our newly created site Collection as below. 




Experience Version : 

At the time of creating the site Collection if we select Experience version to 2010 . 
Then the created site collection looks  as below screen.







 This is one of the ways of creating the site collection in SharePoint 2013.

Thanks for visiting my blog .Hope this post will help you
If you like my post please Share your Ideas.



How to create sub site in SharePoint 2013

No comments

Hi Friends,


I will show you how to create  a new sub site in SharePoint 2013.

Unlike SharePoint 2010 , we dont have option to create  new Site under (Settings icon ) in SharePoint 2013.

In SharePoint 2013 ,only one extra Click we need to have for creating SharePoint Site .

Settings Icon -->Site Contents---> new Subsite




How to Create Site Column in SharePoint 2013

No comments


Hi Friends,

Today i will describe  you about the site columns in SharePoint 2010,2013.


  Site Column :
  A Column which can  be created at root site level and can be accessible inside all the available child sites or Sub Site 's Lists or Document Libraries  under the root site .

Purpose :
   Some  times we get a situation where some columns inside lists or doc libraries needs to be created multiple times and  use them. So at that time  instead of creating a column inside of each and every list simply we can create a site Column at root site level .
Then we can use the site column just by adding to list .


Please find the below steps for creating Site Column using Out of feature .

select settings Icon --->Site Settings

Under Designer Galleries  --Click on Site Column


By Default we can see all the list of Site Columns provided by SharePoint . 
To Create a new site column . Click on Create


 Give Column Name and select  Data Type for the column



Here , If we want to create a new group we can also create new group or we can use existing group but for our understanding i have created a new gropName "NewSiteColumn"



Now you can see , newly created group (newSiteColumnGroup) along with Site Column.



Now we add the Site Column to  your list say (Student List created already ).

Select list -->Click on List Settings





Click on Add From exsiting  site columns  and click on OK

 
 Now go the  List and click on add new item .

You will  be seen the Site Column.as below .


This is how we create new  Site Columns in SharePoint 2010, 2013 .




Guys ,
Thanks for visiting my blog .Hope this post will help you

If you like my post please give comments .

Thanks in advance


Tuesday, October 28, 2014

Get Latest Version of a SharePoint List Item in 2010,2013

No comments

Hi Guys ,

Some times we come across a situation where we need to know the latest list item version .

Please find the method to get the latest list item version using Server object model.


 Public SPListItem TopListItemVersion(SPListItem item) 
            {      
                if ((item.Versions != null) && (item.Versions.Count > 0)) 
                { 
                    SPListItemVersionCollection versions = item.Versions; 
                    SPListItem latestItemversion; 
                    if (item.Versions.Count > 1) 
                        latestItemversion= item.Versions[item.Versions.Count - 1].ListItem; 
                    else 
                        latestItemversion= item.Versions[0].ListItem; 
     
                    return latestItemversion; 
                } 
                else 
                 
                    return item;            
             } 

Standard coding practices in Sharepoint Server Object Model

No comments

Best Coding Standards that we need to look into when we code in Server Object Model .


Wednesday, October 22, 2014

Create Custom List Programmatically in SharePoint 2013/2010

No comments
using (SPSite oSPsite = new SPSite("http://Web URL"))
{
    oSPsite.AllowUnsafeUpdates = true;

    using (SPWeb oSPWeb = oSPsite.OpenWeb())
    {
        oSPWeb.AllowUnsafeUpdates = true;

        /* 1. create list from custom ListTemplate present within ListTemplateGalery */
        SPListTemplateCollection lstTemp = oSPsite.GetCustomListTemplates(oSPWeb);
        SPListTemplate template = lstTemp["custom template name"];
        oSPWeb.Lists.Add("List Name", "Description", template);


        /* 2. create list from sharepoint list content type (e.g. Links) */
        oSPWeb.Lists.Add("List Name", "Description", SPListTemplateType.Links);

        oSPWeb.AllowUnsafeUpdates = false;
    }

    oSPsite.AllowUnsafeUpdates = false;
}

Create list in SharePoint 2013 using OOB feature:

No comments


Hi Guys,

I  will let you know , how to create a  custom list in  SharePoint 2013.

The only confusion to create list unlike SP2010  is we need to select App for creating the List


Select Settings Icon--->Site Contents-->Add App-->Select Custom List-->Name the List-->Create.

here we go...we have successfully created..

Now you can create your own custom Columns of your choice ..

If you want to create a new column --->Select New Column from ribbon ..














Thursday, October 16, 2014

Export Grid View Data to Excel

No comments
private void ExportGriviewToExcel(System.
Web.UI.WebControls.GridView gvReport, string fileName)
        {
            try
            {
                DateTime dtCurrentdate = System.DateTime.Now;
                fileName = fileName + '-' + dtCurrentdate.Date.ToShortDateString();
                var attachment = "attachment; filename=" + fileName + ".xls"; //Setting the attachment name.
                HttpContext.Current.Response.ClearContent(); //clears all content output from the buffer stream.
                HttpContext.Current.Response.AddHeader("content-disposition", attachment);
                HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
                using (var sw = new StringWriter())
                {
                    using (var htw = new HtmlTextWriter(sw))
                    {
                        using (var frm = new HtmlForm())
                        {
                            gvReport.AllowPaging = false;
                            gvReport.DataSource = dtTAt;
                            gvReport.DataBind();
                            gvReport.Parent.Controls.Add(frm);
                            frm.Controls.Add(gvReport);
                            frm.RenderControl(htw);
                            HttpContext.Current.Response.Write(sw.ToString());
                            HttpContext.Current.Response.End();
                        }

                    }
                }

            }
            catch (Exception ex)
            {

               
            }
        }

People picker Browser Compatability Issue

3 comments






People Picker is not working on computers that have IE 11 installed

Unfortunately this is a known issue with People Picker and IE Version 11 and probably 10 as well.

Recently i came across a situation where am not able to work with people picker in IE 11 but am able to open the same thing in IE 9 and other browsers as well. So i started trying to identify the issue .

anyhow i will explain you how to fix it but this is a short-term solution. If Microsoft comes up with solution then we can go ahead .


Title       : People Picker Compatibility issue in IE 11 Browser .
Meta Tag    :  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />

Description   :

Phyisical path of  pickerdialog.master file : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS.
Please take the back up of pickerdialog.master from production .
Open the pickerdialog.master add the meta tag  “<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> under head section”.
Save the pickerdialog.master .
Followed by IISREST.

Wednesday, October 15, 2014

Creation of List View Web parts in SharePoin 2013 and 2010

No comments

Some times we come across a situation where in we want to display list data on the home page or any other pages .

I will show you the simple way of creating the List view  web parts in SharePoint 2013



Create any custom list inside of your site. say "Students".

Now , you want to see the list  on the page as a report or something else .



Create page or existing page ...


Edit Page --> add web Part-->webparts gallery --->Lists and Libraries (Under this  section you will be able to see the list "Students". Select the List and Click ok .



Then the list will be placed on your page .

By default it will show you all the columns inside the list "Students".



If you wants to see only particular columns as per your interest then you can modify the view

By editing the web part we can modify the  Current View also .

Note : 
All the Views created inside the list will be Shown in  web part . If you done any changes inside list view again you need to edit that webpart and set that as default then only the changes reflects..




Applying Site Page as default home page in SharePoint 2010 and 2013

No comments
Goto Site Actions-->Site Settings-->Look and Feel --->Welcome page

Change the Page url ...

All set now you are able to see the site page as  home page of your site .


  1. Programatically......Changing the Welcome  Page  

public static void ChangeWelcomePage(SPWeb rootWeb, string pageName)
{
    if (PublishingWeb.IsPublishingWeb(rootWeb))
    {
  PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(rootWeb);
  //Get the file name
  SPFile welcomeFile = rootWeb.GetFile(pageName);
  //Assign the new filename to the DefaultPage property
  pubWeb.DefaultPage = welcomeFile;
  //Update the Publishing Web.
  pubWeb.Update();
    }
}

Power Shell .


Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
################################################### code###################################################
$sourceWeb = $null try { $SiteUrl = "http://adigroup/myteamsite" $sourceWeb = Get-SPSite -identity $SiteUrl $oFolder = $sourceWeb.RootFolder; $oFolder.WelcomePage = "Pages/MyCustomPage.aspx"; $oFolder.Update();
} catch { write-host $_.exception
} finally { if($sourceWeb -ne $null){$sourceWeb.Dispose()}
}



Monday, October 13, 2014

Importance and Difference between SPListItem.Delete() method and SPListItem.Recycle() method.

No comments
If you delete a document in SharePoint using the UI, it’s being moved to the Recycle Bin, so that it can be restored if necessary. There are situations when you want to include deleting list items and documents in your custom solutions. The most commonly used approach I’ve seen is calling the SPListItem.Delete() method. While this does the job, and deletes the item, it deletes it permanently instead of moving to the Recycle Bin.

Looking carefully at the SPListItem class, you can find SPListItem.Recycle() method. It turns out that it’s exactly that method that you need to call in order to move a list item/document to the Recycle Bin instead of deleting it permanently.

In general moving items to the Recycle Bin instead deleting them permanently is what you should do in our custom solutions. It is standard SharePoint behavior and therefore something end users will expect of our solutions as well. You should perform the permanent deletion only if explicitly named in the requirements. Otherwise, let’s just stick to what SharePoint does to leverage the same User Experience.

Internally there isn’t much difference between the SPListItem.Delete and SPListItem.Recycle methods. Both call an internal SPListItem.Delete method with a different parameter which determines whether an item should be moved to the Recycle Bin or permanently deleted.

  1. public override void Delete()   
  2. {   
  3.       if (this.HasExternalDataSource)   
  4.       {   
  5.             SPUtility.ValidateFormDigest();   
  6.             string bdcid = (string) ((string) this.GetValue("BdcIdentity"));   
  7.             this.ParentList.DataSource.DeleteItem(bdcid);   
  8.       }   
  9.       else   
  10.       {   
  11.             this.DeleteCore(DeleteOp.Delete);   
  12.       }   
  13. }   
  1. public System.Guid Recycle()   
  2. {   
  3.       if (this.HasExternalDataSource)   
  4.       {   
  5.             SPExternalList.ThrowNotSupportedExceptionForMethod("Recycle", base.GetType());   
  6.       }   
  7.       return this.DeleteCore(DeleteOp.Recycle);   
  8. }   
  9.