Friday, September 9, 2011

SharePoint 2010 - Error while creating site from Site Template and Resolution

faced a issue while creating a site from a site template. Below is a screen shot of the error.


This error pops up if the site has been restored from a installation where Reporting Services has been installed on Integrated Mode and then restoring the site to a installation where there is no reporting services installed. The content types do not match and hence the error.

Solution:
Install Reporting services in Integrated Mode on the new server and then uninstall the Reporting services feature. This will delete the content types. The re-create the site template and create sites using the template.

Monday, September 5, 2011

SharePoint 2010 - Centered Screen with Fixed Width Design

Steps to be followed:
Step 1: Open up your custom master Page and remove scroll="no" from the body. If you don't do this there will be no scroll bars on long pop up modal windows.


image


Step 2:  Search for “s4-workspace” in the Master Page and remove whole DIV tag and its close Div tag at the bottom of the master page. This ID is tied to a JavaScript file that forces a full width on the page.


Step3: Now Open up your CSS file and add the following:
          body{
                   overflow:auto !important;
                  }
         form 
                {
                  width:980px;
                  margin: auto;
                 }


Step 4: If you wanted to add some background color and borders to enhance the centered design replace it with this:

    body{
            overflow:auto !important;
            background-color: #21374c;
           }
   .s4-widecontentarea{
            background-color: #FFF;
           }
    form
          {
            width:980px;
            margin: auto;
          }




Drawback: 

  1. By default the ribbon is intended to stay static and always be visible to the contributors on the top of the page. However due to the complexity of fixing a site’s width. 
  2. The last draw back to fixing the width of a SharePoint 2010 site is that the content is within a floating <DIV> tag and if the content gets very wide by either a fixed with image or a list with many columns displayed it will spill off the page

Friday, September 2, 2011

SharePoint 2010 - Change the maximum file size to be Uploaded

Login to Central Admin and navigate to


Central Administration -> Application Management -> Manage Web Applications

Highlight the web application that you want to change and then click on "General Settings" tab on the ribbon.



Scroll to the bottom of the list and you will see the maximum upload size the default setting is 50mb this can be can set to a maximum size of 2047mb. If you try to go beyond this it does flag up and tell you that you have exceeded the Maximum size.

Tuesday, August 23, 2011

SharePoint 2010 - Hide the Quick Launch(Quick Way) using Content Editor Web Part


Just add a the Web Part Content Editor and add the following text in the HTML Source mode:

/*--Hide Quick Launch --*/



<style type="text/css">
#s4-leftpanel{
display:none
}
.s4-ca{
margin-left:0px
}

</style>

Monday, August 22, 2011

SharePoint 2010 Publishing - Programmatically inheriting master page from parent site


Below is a code snippet for Programmatically inheriting master page from parent site

PublishingWeb area = PublishingWeb.GetPublishingWeb(web);
                area.Navigation.InheritGlobal = true;

                area.MasterUrl.SetInherit(truetrue);
                area.AlternateCssUrl.SetInherit(truetrue);


                area.Update();

Note: Add reference to Microsoft.SharePoint.Publishing.dll

Wednesday, August 10, 2011

SharePoint 2010 - Use [Today] and [Me] in Calculated Column


If you try to create column with field type : calculated and want to use current date as part of formula , the first thing that comes up in mind is to use [Today] as SharePoint gives it as filter option while creating views. But unfortunately if you try to add ‘[Today]‘ in formula, it gives error : “Calculated columns cannot contain volatile functions like Today and Me”


Same error goes when trying to use “[Me]” too.
Well, a nice trick can allow you to do this.

  • Open up the List Settings page where you want this column.
  • Create column named “Today”. The type doesn’t matter here, so let type as “Single Line of Text” and just click “Ok”.
  • Now create the calculated column where you need to use current date within formula and add “Today” from available columns
  • Once this is done, we no longer need that our own generated column “Today” so you can delete it (Although when you need to edit formula you will need this again, so either recreate this dummy Today field or make it hidden using code behind. Otherwise SharePoint will put you again on that error screen).
    This will trick the SharePoint to use [Today] (current date) as part of formula. 


    You can apply same trick for the current user i.e. [Me] too. Create a dummy field named “Me” use it in your formula, save the calculated column, and delete that dummy “Me” field.



    For calculated fields, calculated value is stored in Database when item is created at first time and doesn’t change until item is edited. So using Today doesn’t means each time you will get value re-calculated as per actual today’s date. For that it is better to use Computed column.


    This trick tells how you can use Today & Me for calculated fields. Its secondary thing whether to use them or not. This totally depends upon usage of calculated field. For example you can use this in project management site for issues list, whenever new issue item is created you need to auto calculate the minimal duration and base on production push date of solution.




Saturday, July 9, 2011

SQL - Steps for connecting SQL server 2008 from sqlserver 2005 management studio

issue while I want to connect SQL server 2008 from SQL server 2005 management studio due to forward compatibility. I got solution for that by using below mentioned Steps
  1. Click the Windows "Start" button and select "All Programs." Click the "SQL Server 2005" program group and then click "SQL Server Management Studio" from the list of shortcuts. This opens your database console screen.

  2. Click your 2005 database name on the left side of the window. Click the "New Query" button to open your query window.

  3.  Type the following code into your query window:


    EXEC sp_addlinkedserver '2008Server','SQL Server';
    Replace "2008Server" with your SQL Server 2008 server name. The "N'SQL Server'" text tells the stored procedure to use the SQL Server drivers to connect

  4. Press the "F5" key to execute the statement and connect to the server. The new linked server name is displayed on the left of your window.