May 23, 2012

Error: The language-neutral solution package was not found.

While using Visual Studio, you may get the following error
“The language-neutral solution package was not found.”
Solution:
There are three ways you can fix this problem:
1. This may be caused due to the CACHING issue in the Visual Studio and hence restarting the Visual Studio will help you in fixing the issue.
2. Sometimes the solution you are trying to update will not get updated properly. Hence delete the following folders (By navigating to In Visual Studio   -> Right click on project in Solution Explorer window -> Select Open folder in Windows Explorer)  bin, obj and package.
After deleting these folders, rebuild and deploy the solution which will work out.
3. Or finally, you can retract the solution from the Central Admin (in case of SharePoint related issues) and then uninstall the solution dll from the assembly folder. Then try to deploy the solution.
Please free to comment and share this post, if this helps you!

May 16, 2012

Chart Controls in ASP.Net

I was looking at creating chart controls for implementing in the .Net web applications. I didn’t like to use the 3rd party tools or any freeware tools. Well, while browsing found a cool feature provided by MICROSOFT for the same.
In this article, we will have a look at the CHART CONTROLS in .Net applications.
Pre-requisites
Ø  Visual Studio 2008 SP1, Link to download
Ø  .NET Framework 3.5 SP1, Link to download
Ø   Microsoft Chart Controls, Link to download
Ø  Visual Studio 2008 Add-on for the Chart Controls, Link to download
Ø  Documentations by Microsoft, Link to download
Ø  Web and Windows Application Samples, Link to download
Types of Charts
Ø  Area Charts
Ø  Bar column Charts
Ø  Circular Charts
Ø  Combination Charts
Ø  Data Distribution Charts
Ø  Error Bar
Ø  Financial Charts
Ø  Line Charts
Ø  Pie Doughnut Charts
Ø  Point Charts
Ø  Price Range Financial Charts
Ø  Pyramid Funnel Charts
Ø  Range Charts
Examples
The examples provided by Microsoft are very clear and easy. Hence you can download and try the samples. Also, the control is easy to use, just drag and drop the control and start using it.
Namespace
The namespace which we use here is System.Web.UI.DataVisualization.Charting.
More about Chart Controls
Ø  This control is not available for Visual Studio 2005.
Ø  It is available as a native component in Microsoft Visual Studio 2008 SP1.  First you have to install the Chart Controls provided by Microsoft and then the add-ons for using the control.
Ø  But in Visual Studio 2010, it is present as inbuilt component. We can just use it!
More Useful Reference Links
Installing and using Chart Controls in Visual Studio 2010, here.
Using Chart Controls in Visual Studio 2005, here.
Happy Sharing!

Windows System Shows Blank Screen after logging in

Scenario:
I have faced many situations like after logging into the Windows Operating system machine (Especially Windows 7 and Windows Server which I have faced); it takes more hours showing a BLANK SCREEN without showing the desktop. It wasted my time more. So I was searching for a solution which would help in fixing the issue.
Solution:
1. Press CTRL + ALT + DEL
2. Select Start Task Manager from the list
3. In the Task Manager Select -> File -> New Task (New Task (Run...)) – I have Win 7 as shown below:
4. Type “Explorer” in the text box and click OK.
5. Now, you will see the explorer opening suddenly and also your desktop is ready to use.
Hope this helps some one’s time. Happy Sharing!

May 14, 2012

Change the Color of a Column in a List in SharePoint

In this article, we will know how to change the color of a column based upon the values in the column. It is something like “Color Indicator” in SharePoint.
Scenario:
We have a custom list used for Project Tracking. In the list, we have column named STATUS for tracking the project.
Whenever an item in the list is updated with the status in the column, then the background color of the status column should automatically change depending upon the status. Hence it gives a better UI for tracking the status.
Solution:

1. Create a custom list named “Project Tracking System” with the columns such as “Title”, “Description” and Status with the data type as shown below:

Columns with the data types to be created:

2. Now, we will insert 4-5 items in the list created. 
In the above list, we can see that the status column is updated, but it would be good when we have background color of the each status separately. It is gives easy tracking to the users.
3. We can achieve this through JAVA SCRIPT
4. Add a Content Editor Web part below the list as shown below:
5. Now in the content editor web part, add the below java script code (Open the tool pane->Source Editor->Place the Java Script->Click Ok) and save the page.
Add the below code in the script JavaScript tag
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var colorCode = document.getElementsByTagName("td")// finding all the TD tags
var i=0; 
for (i=0;i
{
if (colorCode[i].className=="ms-vb2")  
{ 
if (colorCode[i].innerHTML=="Not Started")//finding the word to which the color has to be set
{ 
colorCode[i].style.backgroundColor='lightblue'; // setting the color depending upon the value
colorCode[i].style.color='Black'; // setting the color of the words inside the content                                     
} 
if (colorCode[i].innerHTML=="Started")  
{ 
colorCode[i].style.backgroundColor='Brown';
colorCode[i].style.color='Black';
} 
if (colorCode[i].innerHTML=="In Progress")  
{ 
colorCode[i].style.backgroundColor='Orange';
colorCode[i].style.color='Black'; 
} 
if (colorCode[i].innerHTML=="Completed")  
{ 
colorCode[i].style.backgroundColor='green';
colorCode[i].style.color='Black'; 
} 
if (colorCode[i].innerHTML=="Deffered")  
{ 
colorCode[i].style.backgroundColor='Red'; 
colorCode[i].style.color='Black'; 
} 
} 
}

6. Now, you can see the status column background is changed depending upon the status inserted for each item as shown below:
It gives good interface to the users and also we can categorize the status easily.
Please free to comment and share the post, if it helps you!

May 10, 2012

Remote Blob Storage (RBS) in SharePoint 2010

In this article, we will know about a new feature in SharePoint 2010 which allows the remote storage in SharePoint.
What is Remote BLOB Storage?
     Ø  BLOB – Binary Large Object
Ø  Remote BLOB Storage (RBS) is a library API set that is incorporated as an add-on feature pack for Microsoft SQL Server.
Ø  It can be run on servers with Microsoft SQL Server 2008 R2, SQL Server 2008 or SQL Server 2008 R2 Express. To run RBS on a remote server, you must be running SQL Server 2008 R2 Enterprise edition.
Ø  RBS is not supported for Microsoft SQL Server 2005.
Ø  In Microsoft SharePoint Server 2010, RBS can be used for content databases only.
Why RBS?
It provides the following benefits:
Ø  BLOB data can be stored on less expensive storage devices that are configured to handle simple storage.
Ø  The administration of the BLOB storage is controlled by a system that is designed specifically to work with BLOB data.
Ø  Database server resources are freed for database operations.
When to Go for RBS?
Ø  Large Database of Mostly Binary Data
Ø  Digital Asset Management Databases
Ø  When Storage Tiers Need to be Implemented
Ø  When Storage Needs to be Optimized
You can expect to benefit from RBS in the following cases:
Ø  The content databases are larger than 500 gigabytes (GB).
Ø  The BLOB data files are larger than 256 kilobytes (KB).
Ø  The BLOB data files are at least 80 KB and the database server is a performance bottleneck. Then, RBS reduces the both the I/O and processing load on the database server.
RBS Advantages over EBS (External Blob Storage)
Hope this explains about the basics of RBS in SharePoint 2010.
I came across a good article explaining about Configuring Remote Blob Storage for SharePoint 2010. Here is the link.
Happy Sharing!

May 9, 2012

CAML Query to Get Data from SharePoint List

To know about the Basics of the CAML query read this article.
To know about using CAML query builder to create CAML queries, read this article.
In this article, we will learn how to use CAML query in Microsoft Visual Studio
Scenario:
I have a custom list named “Product List” with the columns named Title, Price, Quantity and Is Available.
I want to retrieve the products with price greater than 1000 and lesser than 10000. Then I have to order the results depending upon the quantity in descending order.
Using the CAML query builder, I have created a CAML query for the above scenario and the query is as follows:
<Query><Where><And><Gt><FieldRef Name="Price" /><Value Type="Number">1000</Value></Gt><Leq><FieldRef Name="Price" /><Value Type="Number">10000</Value></Leq></And></Where><OrderBy><FieldRef Name="Price" Ascending="False" /></OrderBy></Query>

Implementing CAML Query in Microsoft Visual Studio
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace UsingCAMLQuery
{
    class Program
    {
        static void Main(string[] args)
        {
            const string camlQuery = @"100010000";
            try
            {
                using (SPSite objSite = new SPSite("sitename"))
                {
                    using (SPWeb objWeb = objSite.OpenWeb())
                    {
                        // Building a query
                        SPQuery query=new SPQuery();
                        query.Query=camlQuery;
                     
                        // Retrieving the data from the List
                        SPList objList=objWeb.Lists["Product List"];
                        SPListItemCollection items= objList.GetItems(query);

                        // Prinitng the header
                        Console.WriteLine("{0,-25} {1,-20} {2,-15} {3}", "Title", "Price", "Qunatity", "Is Available");

                        foreach (SPListItem objListItem in items)
                        {
                            Console.WriteLine("{0,-25} {1,-20} {2,-25} {3}", objListItem["Title"], objListItem["Price"], 
                                                                             objListItem["Quantity"], objListItem["Is Available"]);
                        }

                    }
                    Console.ReadLine(); 
                }
 
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error Occured:", ex.Message);
            }
            Console.ReadLine();
        }
    }
}
The full solution can be downloaded from the following link
Please free to comment and share this post if it helps you!

The list cannot be displayed in datasheet view for one or more of the following reasons in SharePoint

I was easily changing my list view by edit in data sheet view and in standard view. 
After sometime, when I tried to edit a SharePoint list in DATASHEET view, I got the following error which doesn't allow me to view the list in the datasheet view and shown up a error as shown below:
Solution:
Clearly, the problem is due to some DLL's in the MS office is creating this problem.
Hence, either of the following solutions will help you to fix this error:
Microsoft Office diagnostics
Run the Microsoft office diagnostics tool by navigating to the following location:
Start -> All Programs -> Microsoft Office -> Microsoft Office Tools -> Microsoft Office Diagnostics
This will repair the office setup installed in the machine. you may see the following screens running once started
Once completed, you will see the following screen:
                            
Installing Office2007 SharePoint Components
I read a wonderful article for this and the link is
Either of the above solutions will help you in fixing this issue.
Hope this saves some one’s time. Happy Sharing!

Using CAML Query Builder for SharePoint

To know about the Basics of the CAML query read this article.
Download Link
Use the following link to download the CAML Query builder.
How to use CAML Query Builder to create a query
Following are the steps for using the CAML query builder to create a CAML query
1. Open the CAML query builder. Type the URL to connect to the SharePoint site and check Credentials of the current user to login

2. Once clicked connect, you will see the following window SharePoint site with all the lists and libraries in the site in a tree view structure which is shown below: 

3. Now we will create a new query on a list named “Product List” as shown below:

4. We will start creating a new query which is as follows:



5. You will find the query being created depending upon your selection from the list

6. Clicking on Execute, you will see the query being executed and the result is being displayed in the result tab as shown below:

The Query created is:
<Query>
           <Where>
                       <Gt>
                              <FieldRef Name="Quantity" />
                              <Value Type="Number">0</Value>
                      </Gt>
          </Where>
          <OrderBy>
                       <FieldRef Name="Price" Ascending="True" />
          </OrderBy>
</Query>
Hence, CAML Query Builder allows us to create the queries very easily so that it can be used in the SharePoint programming.
Now, we will have a question, how to use this query in the Visual Studio to retrieve the data from a list.
To know how to use CAML query in Visual Studio programming, read this article.

Import Excel Sheet to SharePoint List

In this article, we will learn how to export the excel data to the SharePoint list.
Steps:
1. Click on Site Actions -> More Options 
2. Now click on the Lists -> Select Import Spread Sheet from the type -> then Click Create 
3. Give the Name and Description of the List to be created and then browse the Excel Sheet to be uploaded
4. Clicking on Import option, you will find see a popup window opens. Select Range of Cells in the Range Type
5. This option allows you to select the table columns and rows in excel as shown below. After selecting, you will see the selected field’s column and row data being populated in the Select Range field in the popup window
6. Now click on Import in the popup window. Your SharePoint list will be created from the Excel Sheet and the values are also populated as shown below:
You may face some issues while importing the Excel Sheet to SharePoint and the solution is follows:
Error: “Method ‘Post’ of object ‘IOWSPostData’ failed” in SharePoint
Solution:
 Ø  Open the Excel Sheet Add-In EXPTOOWS.XLA which will is available at the following location C:\Program Files\Microsoft Office\Office12\1033 by default.
 Ø  Press Alt+F11 to display the Visual Basic code editor. Locate the form named "PublishForm" under the folder "Forms" and open the code view of this form.
 Ø  Search (Ctrl+F) for the line "lVer = Application.SharePointVersion(URL)" and place a new line "lVer=2" after that line.
 Ø  Now try to import the Excel Sheet to the SharePoint, you will not get any errors.

Error: "The specified file is not a valid spreadsheet or contains no data to import"

Solution:
This error occurs when the site you are opening do not have permission to file system. To give permission follow the below steps:
In Internet Explorer click Tools --> Internet Options -> Click Security tab --> Select Trusted Sites --> In the Sites add your URL here.
Now you will be able to import the file properly.
Hope this post helps you! Please free to comment and share this post.

May 8, 2012

CAML Query tutorial for SharePoint

In this article, we will understand the basics of CAML query in SharePoint.
What is CAML?
  Ø  CAML - Collaborative Application Markup Language
  Ø  XML- Extensible Markup Language based query language
  Ø  Used to perform a query operation against SharePoint Lists
How SharePoint List Items are retrieved?
SharePoint List data can be retrieved in any one of the following ways:
1. Using the SharePoint object model – used when code runs on the server (Example: Developing a web part or an application page)
2. Using the SharePoint Lists web service – used when your code doesn’t run on the server where the SharePoint is installed (Example: Developing a windows application)
3. Using Power shell –used mostly by the ADMIN of the SharePoint when they quickly want to retrieve some information from the SharePoint site
How does CAML query looks like?
As I already mentioned, it is XML based query language and it contains tags in it. The root element of the CAML query root element is Query. But it is not necessary to use Query element in the query you form.
Within the Query element you have two elements possible:
1. Where   – to filter the data
2. OrderBy – to categorize the data
A simple structure of the CAML query is as follows:
<Query>
          <Where>
                   <Eq>
                             <FieldRef Name=”FieldName” />
                             <Value Type=”DataType”>Value</Value>
                   </Eq>
          </Where>
          <OrderBy>
                             <FieldRef Name=”FieldName” />
                             <FieldRef Name=”FieldName” />
          </OrderBy>
</Query>
Operators in CAML Query
From the above structure, we came to know that it uses Where and OrderBy elements to retrieve the data from the list.
Let us know about the operators present in the CAML query and its usage:
Inside the Where element
1. Logical Operators - AND, OR
2. Comparison Operators - Listed Below in the table
AND – Which takes two conditions are satisfied
OR – Which takes when either of the conditions is satisfied
Comparison Operators

Inside the OrderBy/GroupBy element
OrderBy – Which orders or sort the data depends upon the field (FieldRef element) given.
GroupBy – Which groups the data depends upon the group by field (FieldRef element) given.
Examples
Logical & Comparison Operators
Use of AND, Gt, Leq
<Query>
<Where>
<And>
<Gt>
<FieldRef Name="Quantity" />
<Value Type="Number">0</Value>
</Gt>
<Leq>
<FieldRef Name="Price" />
<Value Type="Number">2000</Value>
</Leq>
</And>
</Where>
</Query>
Use of OR, Gt, Leq
<Query>
<Where>
<Or>
    <Gt>
<FieldRef Name="Quantity" />
<Value Type="Number">0</Value>
    </Gt>
                     <Leq>
  <FieldRef Name="Price" />
<Value Type="Number">2000</Value>
    </Leq>
               </Or>
       </Where>
</Query>
Use of BeginsWith, Leq
<Query>
<Where>
<And>
     <BeginsWith>
 <FieldRef Name="Title" />
 <Value Type="Text">M</Value>
     </BeginsWith>
     <Leq>
    <FieldRef Name="Quantity" />
<Value Type="Number">1000</Value>
     </Leq>
</And>
</Where>
<OrderBy>
<FieldRef Name="Price" Ascending="False" />
</OrderBy>
</Query>
OrderBy Operator
<Query>
<Where>
<Or>
   <Gt>
<FieldRef Name="Quantity" />
<Value Type="Number">0</Value>
  </Gt>
    <Leq>
<FieldRef Name="Price" />
<Value Type="Number">2000</Value>
  </Leq>
</Or>
</Where>
<OrderBy>
<FieldRef Name="Price" Ascending="True" />
</OrderBy>
</Query>
Is it possible to write this queries without any errors manually?
Yes. But we will know the errors only after executing the program. Hence there is a free CAML query builder which will generate the query easily.
To know about where to download and how to use the CAML Query builder read this article.
To know how to use the CAML query in the Microsoft Visual Studio read this article.