November 24, 2011

Checking whether a file uploaded is of .doc or .docx file format

We can use the Java Script to check whether the file uploaded is of 2003 or 2007 word format. Hence we can handle the validation in the client side.
Java Script
<script type="text/javascript" language="javascript">
   function FileFormatValidate()
        var uploadControl = document.getElementById('<%=FileUpload1.ClientID%>').value;
        //Regular Expression for the fileupload control.
        var reg = /^(([a-zA-Z]:)|(file://%7b2%7d/w )/$?)(//(/w[/w].*)) (.doc|.docx|.DOC|.DOCX)$/;
        //Checking if the file is empty or not
        if (uploadControl.length > 0) 
            //Checks with the control value.
            if (reg.test(uploadControl)) 
                return true;
                //If the condition not satisfied shows error message.
                alert("Only .doc, docx files are allowed!");
                return false;
            //If the File is Empty or No File is  selected to upload shows this 
error message.
            alert("Please select a file to Upload");
            return false;
    } //End of function FileFormatValidate.
<p style="height: 28px; width: 216px">
    <asp:Button ID="btn_Upload" runat="server" Height="25px" 
        onclick="btn_Upload_Click" OnClientClick="return FileFormatValidate();" Text="Upload" Width="128px" />

Hence you can validate and check the file being uploaded at the client side using this code. This can be re-used for any file formats by changing the Regular Expression.
Happy Coding!!!

List of SharePoint 2010 Web Parts

 Content Editor 
 Image Viewer
 Media Web Part
 Page Viewer 
 Silverlight Web Part
Business Data
 Business Data Actions
 Business Data Catalog Filter
 Business Data Item
 Business Data Item Builder
 Business Data List
 Business Data Related List
 Key Performance Indicators
 KPI Details
 Visio Graphics Service 
Content Rollup
 Chart Viewer
 Content Query
 HTML Form Web Part - Foundation
 Picture Library Slideshow Web Part
 RSS Viewer
 XML Viewer
 What’s Popular
 Document ID Lookup
 Document Set Contents
 Document Set Properties
 Relevant Documents
 Choice Filter
 Current User Filter
 Date Filter
 Filter Actions
 Page Field Filter
 Query String URL) Filter
 SharePoint List Filter
 SQL Server Analysis Services Filter
 Text Filter
My Information My Calendar
 My Contacts
 My Inbox
 My Mail Folder
 My Tasks
 Site Aggregator
 Sites in Category
 Summary Links
 Table of Contents
 Tag Cloud
Office Client Applications Excel Web Access
 InfoPath Form Web Part
 WSRP Viewer
 Contact Details
 Profile Browser
 Site Users - Foundation
 User Tasks - Foundation
 PerformancePoint Filter
 PerformancePoint Report
 PerformancePoint Scorecard
 PerformancePoint Stack Selector
Search Advanced Search Box
 Dual Chinese Search
 Featured Content
 Federated Results
 People Refinement Panel
 People Search Box
 People Search Core Results
 Refinement Panel
 Related Queries
 Search Action Links
 Search Best Bets
 Search Box
 Search Core Results
 Search Paging
 Search Statistics
 Search Summary
 Top Federated Results

Deafult.aspx is not opening in the SharePoint Designer

PROBLEM: Deafult.aspx is not opening in the SharePoint Designer

Error Details   

     Soap: Server was unable to process request. A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered as safe on this site. You may not be able to open this page in an HTML editor that is compatible with Microsoft Windows SharePoint Services, such as Microsoft Office SharePoint Designer. To fix this page, contact the site administrator to have the Web Part or Web Form Control configured as safe. You can also remove the Web Part or Web Form Control from the page by using the Web Parts Maintenance Page. If you have the necessary permissions, you can use this page to disable Web Parts temporarily or remove personal settings. For more information, contact your site administrator.


The problem is that the default.aspx page may contain some error web parts which can be removed by hitting the following url

This will open the web part maintenance page. So, here you can delete the error web part.

What is 12 and 60 Hive in SharePoint ?

You'll hear SharePoint people talk about and refer to the "12 Hive" or the "60 Hive" regularly. We don't know what it is and we use it .

The "Hive" concept was coined by Todd Bleeker. So what does it mean?
12 Hive is the location where MOSS 2007 and WSS 3.0 install their files on the file system. 
The same thing applies to 60 Hive which, as you may guess is the location of SPS 2003 and WSS 2.0 files. 

12 Hive C:\Program Files\Common Files\Microsoft Shared\web server extensions\12
60 Hive C:\Program Files\Common Files\Microsoft Shared\web server extensions\60

Migration of WSS 3.0 to SharePoint Server 2010

I have some ideas grabbed from the internet regarding the migration of WSS 3.0 to SP 2010 server. My thoughts are as follows.
1. WSS 3.0 (with SP2) can be migrated to SharePoint Foundation 2010 directly.
2. The migration of WSS 3.0 (with SP2) to SharePoint Server 2010 is possible by attaching DB upgrade only. The direct migration is not possible.
3. But the WSS 3.0 (with SP2) can be migrated to MOSS 2007 first then to SP Server 2010

SharePoint Designer opens in Contributor mode.

We may face some situation, while editing the site using Sharepoint Designer, it will get open in Contributor mode and we will not be able to edit the site, eventhough we have the Site Collection Administrator (SCA) permission.

By default, Contribute permissions are assigned to the Site Collection Members group. Even though we are part of SCA group, if we are member of Site Collection members the Designer will open in Contributor mode.

To overcome this just disable the contributor settings in SharePoint designer by using the below steps:

1. Open the site in SharePoint Designer.

2. Select the Site Tab -> Contributor Settings.

3. Click on Disable Contributor settings button.

Now we will be able to edit the site.

November 20, 2011