Showing posts with label Sharepoint 2010. Show all posts
Showing posts with label Sharepoint 2010. Show all posts

Friday, October 19, 2012

Custom SharePoint 2010 Ribbon Action for a Specific List Using Visual Studio 2010

Greeting to all my blog readers, we all know how good the sharepoint 2010 Ribbon is, and most wonderfull part is that it is Customizable by using both Visual Studio 2010 and SharePoint Designer 2010.

Recently on Microsoft Technet Forums a person asked this question: "I need a Ribbon Button for a Specific Lists using Visual Studio 2010" as he was thinking to attach Javascript code or CSOM code on that button(not possible with designer way), there was no way he was able to achieve the same using in Elements.xml file.

So i tried my luck with Server Side Object Model to achieve this and later even got the code Client Script object model and Server Side Object Model code to do this. In this blog i am only sharing the way i discovered this in server side object model.
I am showing code written as a Console Application to create a Ribbon Button on Specific List using Visual Studio.

It uses UserCustomActions Collection Property of SPList Object and to add a new UserCustomAction.
The Major Property is:
UserCustomAction.CommandUIExtension, this recieves token from the XML, the same way we enter in the Elements.xml during the traditional way. So here is how my code looks like:-  

 
 
 
 
 
Thats it and you will get a Explicit Ribbon button for a Particular List Only...

Friday, May 4, 2012

SharePoint, How to Implement Logs in my SharePoint Code Easily..

Hi everyone, today I am going to discuss a very important topic of Implementing Logs in SharePoint Code.

As per the scenario the SharePoint Logs which code generates get stores in the 14 hive folder at location:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS

If you try to see this then you can find logs which SharePoint code creates, and also usage reports, next you can use tools like SharePoint Log Viewer to have a Look into these.

So how can we write these logs in our Customizations?

Many People have their own thoughts on Logging; I have myself used several approaches like:
1) Use a text file, deploy it to the Layouts folder and then write the logs into it, benefit with this is we can view these logs from any SharePoint Site url.

2)Use a Custom List on the Specific SharePoint Site  and implement Logging into it.

3)Use SPDiagnosticsServiceBase class  of Microsoft.SharePoint.Administration to create logs in the SharePoint 14 hive folder, the out of box and generic Way.



Here we are going to discuss the general and best approach, approach number 3 as mentioned above.

Tasks we will do:
1)Create a Utility Logger class which inherits from SPDiagnosticsServiceBase.


2)Create a Console Application which will generate the Logs using our Logger.cs  Class.


We will inherit the SPDiagnosticsServiceBase class:
I am trying to re-use the code written here:  SPDiagnosticsServiceBase

Step:1)Code Logger.cs Class.


2) Code for the Console Application/In our Custom Code of SharePoint Solutions:


Finally we can use SharePoint Log Viewer to View the Logs
SharePoint Log Viewer.



 

Monday, March 12, 2012

Creating Custom Workflow Activity using Visual Studio 2010 for SharePoint 2010 (SharePoint A to Z Series)

Hi, since long i was thinking to blog about this topic and finally got a chance to do so. Normally we prefer to create Designer Based Workflows, as they are easy to create, manage and quite flexible.

But still at situations Designer Workflows not allow us to do certain Tasks, for an instance , performing cross site Tasks, like Creating a Document Library in a different site or Creating a new site on certain conditions.
Instead of Creating Complete Workflow we can still use Custom Activities Development in Visual Studio 2010 which is much easier to built and easy to manage for client's Power Users.

So what  i mean is simple “Code an Activity” instead of Coding a Complete Workflow.
Now lets come to the point and follow some steps to create a simple Workflow Activity. Remember this will be Number 1, and quite easy one, later i will post some bigger and much cruciall Activities.
What I’m about to show you is what I did and tested in the following environment: 
• Microsoft Windows server 2008 R2 Enterprise Edition
• SharePoint Server 2010 Enterprise Edition
• MS SQL 2008 Enterprise Edition
• Visual Studio 2010 Ultimate
• Code was done in C# only
(Note: we don’t need the exact environment, but as such a similar one to get started)

Step: 1) Create a Project to support Activity Deployment to Farm

Create an Empty Project in VS2010 and Name it “CustomActivityDemo”, make Sure it should be a Farm Scoped Project.(No SandBoxed), And select the site on which you like to test it /*Empty SharePoint Project*/

Next Click Finish.. It will be just like a scenerio where this project will act as a Rocket Launcher for our Rocket(Activity).. :)
We will setup code and properties later in this, now lets move ahead and create our Activity Project in the Same Solution.
Step :2) Create WorkFlow Activity Project
At the Solution level Right Click and “Add a Project” in VS2010.
Next  Select the Visual C# >Workflow >Workflow Activity Library and set the project name as ‘CreateSiteActivity’.
Now whole solution will appear like this:
Note that after adding Workflow Activity Library Project  a Design view of Activity appears which shows Activity1.cs
lets now follow these subpoints:
• Right click the Activity1.cs and rename it to “CreateSiteActivity.cs”,


• Again Right Click “CreateSiteActivity” and click “View Code”.



• Now add a reference to
 Microsoft.SharePoint.dll and  Microsoft.SharePoint.WorkflowActions.dll   located in ISAPI Library:

• Import the following NameSpaces in the code file:


This will how the code will appear now:
Before going further lets discuss some of the important terminologies:

 
Step :3) Some Introduction to WorkFlow Terminologies:
This will be boring a bit but very quickly please do read these lines as it will clear our process in a bigger way:

Dependency Property
Dependency properties provide a centralized repository of a workflow's state.
The DependencyObject is a hash table that stores the current values of any DependencyProperty that is applied to it.

Dependency Object Class:

An instance type of a dependency property can be bound to instance data, in which case the actual value is not determined until runtime.
You set this type of dependency property's value to be an ActivityBind to bind to the actual value that is accessed at runtime.

ActivityBind binds an activity property to any of the following:
• Another activity property.
• A field.
• A property.
• A method.

In Simpler Word:

Dependency Property provide a mechanism that allows SharePoint Designer to provide values for your custom action before you add your custom functionality.

To allow SharePoint Designer to pass values to your custom action when the workflow runs, you must create public properties inside your custom action. In this example, you will create a custom action that will create a new site within SharePoint whenever executed inside a SharePoint Designer workflow.

Before Writing any Dependency Property and its Binding Property, we have to think about our Inputs, so in this example here are the inputs:

SiteUrl: Where the site will be located.

SiteTitle: Title for the new site.

SiteDescription: Description for the new site.


SiteTemplate: Template to use to create the new site.

InheritPermissions: True, if the new site will inherit permissions from its parent site.


For each field, you create a property in your custom action to allow the users to specify these values when designing their workflow in SharePoint Designer.

When creating properties for a custom action, you create the property itself and a matching DependencyProperty. The DependencyProperty class allows SharePoint Designer to bind the property to the UI in the workflow wizard, where the user specifies the values of these properties in the workflow being created.



Note: Please follow the Syntax we will use while Creating a Property and a Matching Dependency Property, there is Matching Relation require in both of these Names.

Add the following code to create a property and DependencyProperty for SiteUrl:

Parameters it takes are : 1)String Name of the associated Property, Type of Property, Type of Owner(Activity Class Name)



Now for a while just think on what we have written:

Dependency Property Name : SiteUrlProperty and Matching Property Name is SiteUrl
It is required to follow above Syntax i.e always write Dependency Property with Suffix “Property” if you miss this then you will get Compilation Error.
Step: 4) Getting Current Workflow Context

 


Step:5) Complete Rest of Dependency Properties Simmilarly

simmilarly complete the Dependency Properties for rest of inputs we discussed earlier and code should now look like this:

Step:6) Execution of Main Action

Whenever in Workflow the pointer reaches to the Activity then There is an entry method which executes and this method/function is Execute :


We need to override this function to write the functionality of our activity:

This function returns an ActivityExecutionStatus which is an enum containing values. And takes executionsyntax as parameter.


For getting refference to current site , we will use _Context property that we defined above


Step:7) Code to insert in Execute Method:





Note: If an error occured then we have used ISharePointService to logtohistory list whatsoever error occurs.

Step : 8) Create ACTIONS file

NOTE:Before reading the next lines first Sign the Assembly and run "sn.exe -T 'Path to Dll'" command to get the PublicKeyToken Value of CreateSiteActivity.dll

Next Step is to Create an Action File, this file is require to tell Designer how the Activity will appear in UI to the USER, this will make the custom activity to appear in the Wizard.



An ACTIONS file is an XML file that is used by SharePoint Designer's workflow wizard to provide a user-friendly experience for configuring actions. Every action must be configured in an ACTIONS file before it can be used in SharePoint Designer. By default, there is only one ACTIONS file, located at


{14 Hive}\TEMPLATE\1033\Workflow\WSS.ACTIONS, and it contains an entry for each of the built-in actions in Windows SharePoint Services.

 




for a complete refference of this file please visit this msdn article:
http://msdn.microsoft.com/en-us/library/bb897811.aspx

Step:9) Deployment Process

Deployment Process Consists of Four Sub Steps:


1)Sign The Assembly and Get The Public Token and place it in the ACTIONS file:

Right Click “CreateSiteActivity” Project and then go to Properties and then in “Signing”, create a new key name it “CreateSiteActivity”, then BUILD the Project and later Sign the assembly using:

Sn.exe –T “path to CreateSiteActivity.dll”

Note the PublicKeyToken and modify the Actions file accordingly.

2)Place the ACTIONS file to the Worklfow Mapped Folder of SharePoint 14 Hive:


In the CustomActivityDemo project Add a SharePoint Mapped Folder to Template /1033/Workflow

i.e{SharePointRoot}/Template/1033/Workflow and save the above ACTIONS file, with ACTIONS as extension.

3)Deploying CreateSiteActivity DLL to GAC and Create Safe Control in Web Config of the Web Application.


1)Expand the Package Item in the CustomActivityDemo Project,







 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Then double click it, which will open the Package properties then click Advanced.

 click Add. And select Existing Assembly:
Add Necessary Information to add safe control, when complete it will appear as this:

4)Add Authorize Type in web config

To do this, we will include a feature in sharePoint Project: "CustomActivityDemo" (The Rocket Launcher) Project, Name it something Suitable and Scope it to WebApplication:





Then right click the Feature and Add a Reciever:
Add using Microsoft.SharePoint.Administration Namespace to its code file
Uncomment Feature Activated Block.
As scope of the Feature is SPWebApplication , from properties take the instance of feature parent as spwebapplication:

If you see the properties of SPWebAPPlication Instance then you can see a collection WebConfigModifcations:

Now we have to add a new webconfigmodifcation to this collection , to do so create an Instance of SPWebConfigModification class:


SPWebConfigModification modification = new SPWebConfigModification();


Now we will initiate these properties of Modification:

 
 
 
 
Entire Code will appear as this:


Next Build, Package and Deploy your solution.

Step: 10) Test the new Action
Next open the site which we used for testing this project in SharePoint Designer and Create a New List  Workflow  on any of List (take Task).

And in List Actions you can see our newly created activity:

It will Work as it did at my end. Please test yourself and use it in your daily workflow cycle.

Hope it will help and Workflow Activities creation will be now a simple process for you all.

Monday, August 29, 2011

SharePoint 2010 Workflow using Visual Studio 2010

In My previous posts I have taken a developer approach to prescribe the things to go for while developing some custom SharePoint solutions, but here Iwill show one by one every step to achieve this. You’re about to witness an evolution in building workflows for Microsoft, no need for command line deployment, specific configuration of workflow features, and dealing with workflow and feature xml files.


What I’m about to show you is what I did and tested in the following environment:
• Microsoft Windows server 2008 R2 Enterprise Edition

• SharePoint Server 2010 Enterprise Edition

• MS SQL 2008 Enterprise Edition

• Visual Studio 2010 Ultimate

• Code was done in C# only

(Note: we don’t need the exact environment, but as such a similar one to get started)
1. In your SharePoint 2010 create a Document Library (unless you already have one) which can be easily achieved by choosing “New Document Library” from the “Site Actions” menu (located in the top left corner) ,give it a name “Here I have Given: Tax Reports” and click “Create”.
Now you need to create a mock contract template in Word 2010 for your Document Library

2. When in your Document Library, click the Library Settings in The top Ribbon under Library Tag.

3. On the Customize Documents page, locate the Columns section.

4. Create a Employee custom column:


o Click Create Column.


o Type in the column name: “Employee”.


o Select the type Single line of text.


o For the “Require that this column contains information setting” click Yes.


o Click Ok to add the new column.

 5. Add two more columns: a “Employer” column that is type Single line of text and a “TaxAmount” column that is type Currency. Both columns should be required.



6. Return to the document library home page.

7. Under Library Tools, extreme left select “New Document” and create a document.

8.       A new document appears in Word 2010,choose “Enable Editing”. Go to File and observe that there are text boxes for the custom columns from the document library:


9. On the Office menu click Save As. Save the document as %PATH OF YOUR CHOICE%\Contract.docx. If you are prompted to confirm saving to the new Word 2010 file format, click “Ok”.


10. Insert content controls for each of the server properties:
o Place the selection in the document where you want the content control to be placed.
o Select the Insert tab on the ribbon.
o Click Quick Parts, then click Document Property, and then click “Emplyee”.
o Repeat these steps to add content controls in the document for the Employer and the Tax Amount properties.
o For now, leave the content controls empty – do not add text to them.

11. On the Office menu, click Exit Word. When prompted to save changes to the document, click “Yes”.



12. Return to the document library in Internet Explorer, click Settings and then select Document Library Settings.


13. On the “Customize Documents” page, locate the “Content Types” section and click the Document link.

14. NB. If you can’t locate the “Content Types” section, in the “General Settings” section locate “Advanced Settings” in there switch the radio button under “Allow management of content types” to “Yes”, now when you come back to the “Customize Documents” page you should be able to locate the “Content Types” section.


15. On the “List Content Type: Document page”, click the “Advanced Settings” link.


 16. Select the Upload a new document template radio button and then click Browse. Browse to select %PATH OF YOUR CHOICE%\Contract.docx and then click Ok.

17. In Internet Explorer, return to the document library.


18. Upload a new document:

o In the document library, click the “New Document” Library Tools and then click “Document”. Word starts and loads a new document based on the contract template you created.
o Fill in the values for Title, Employee, Employer and TaxAmount. You can fill in the values on the document properties bar (just below the ribbon) or you can fill in the content controls: the end result will be the same.
o Once all required fields have been filled in, on the Office menu, click Save.
o Save the document with a filename of your choice to the document library. If you receive a message that the document must be checked in for it to be visible to others, click OK.
o On the Office menu, click Close. When prompted to check in the document, click “Yes”.
o In the Check In dialog, click Ok to accept the version defaults. Exit Word.
o Your new document appears in the document library. Notice that the Employee, Employer and TaxAmount columns reflect the values you entered in the Word document.


19. You may upload additional documents if you wish.


20. Close Internet Explorer.

Now comes the fun part, creating the workflow itself


21. Start Visual Studio.

22. On the File menu, click New and then click Project. The New Project dialog appears.

23. In the list of Project Types, expand SharePoint select 2010.

24. Select the Sequential Workflow project type.

25. Name the project TaxWorkflow, specify the default location and click “OK”.

 
26.   The New SharePoint Workflow wizard appears. Change the workflow name to TaxWorkflow, use your local site where you created your Document Library (eg http://localhost/yoursite) for debugging and click “Next”.
27. Select ListWorkflow and press next, and then choose the default debug setting and library to associate workflow with

Note: If History, Task List is not presented it would not let you create the workflow, please create Task lIst in case of a blank Site template.


29. The new workflow appears in the designer.


Add a CreateTask Activity to the Workflow


30. If the toolbox is not displayed, then on the View menu, click Toolbox.

31. From the SharePoint Workflow tab on the control toolbox, drag a CreateTask activity and drop it onto the workflow designer between onWorkflowActivated1 and the end of the workflow ( ). The new activity is named createTask1 by default.






32. Configure the TaskID property of createTask1:

o In the Properties window, click the ellipsis for the value of the TaskID property. The Bind ‘TaskID’ to an activity’s property dialog appears.
o Type the new member name myTaskId, ensure that the Create property radio <>button is selected and click OK.




33. Configure the TaskProperties property of createTask1:

o In the Properties window, click the ellipsis for the value of the TaskProperties property. The Bind “TaskProperties” to an activity’s property dialog appears.
o Type the new member name “myTaskProperties”, ensure that the Create property radio button is selected and click OK.

34. In the properties window, select the MethodInvoking handler. Type MyTaskCreation and press the Enter key. The code window appears.

35. Add code to the MyTaskCreation event handler and also add the CustomFieldText function.















36. On the View menu, click Designer to return to the workflow designer.


37. In the Properties window, select the text box for the CorrelationToken property value. Type myTaskToken and press the Enter key.

38. Expand the CorrelationToken property to display the OwnerActivityName subproperty.

39. For the OwnerActivityName subproperty, select Workflow1 in the dropdown.

Add a While Activity to the Workflow

40. If the toolbox is not showing, then on View menu, click Toolbox.

41. Drag a While activity and drop it between createTask1 and the end of the workflow ( ). The new activity is named whileActivity1 by default.

42. In the Properties window, locate the Condition property for whileActivity1.




















43.   Select Code Condition in the property value

44. Expand the Condition property to display the Condition subproperty.

• 1. For the Condition subproperty, type myTaskNotCompleted and press the Enter key. The myTaskNotCompleted event handler appears in the code window.
• 2. In the Workflow1 class, add the taskCompleted variable at the class-level.







 • 3. Add code to the myTaskNotCompleted event handler that will return a result indicating whether or not the task has completed; the task is completed when its PercentComplete property is 1.0.





Add an OnTaskChanged Activity to the Workflow

48. On the View menu, click Designer.

49. If the toolbox is not visible, then on the View menu, click Toolbox.

50. From the SharePoint Workflow tab on the toolbox, drag an OnTaskChanged activity and drop it in the center of whileActivity1. The new activity is named onTaskChanged1 by default.

















 
51. In the Properties window, set the CorrelationToken property of onTaskChanged1 to myTaskToken.


52. Set the AfterProperties property of onTaskChanged1:

o In the Properties window, select the ellipsis for the AfterProperties property.
o On the Bind ‘AfterProperties’ to an activity’s property dialog, select the Bind to new member tab.
o Name the new member afterMyTaskPropertyChange, ensure that the Create Property radio button is selected and click OK.

53. Set the TaskId property of onTaskChanged1:

o In the Properties window, select the ellipsis for the TaskId property.
o On the Bind to an existing member tab, select the myTaskId property and click OK.

54. Double-click onTaskChanged1 in the workflow designer. The Invoked event handler for onTaskChanged1 appears in the code window.

55. Add code to onTaskChanged1_Invoked that will set the taskCompleted variable to true when the PercentComplete property of the task is 1.0.




56. In the Workflow1 class, set breakpoints on the MyTaskCreation and onTaskChanged1_Invoked methods.

Note: To set the breakpoints, select the first line of each method in the code windowand press the F9 key.

57. Press F5 to start debugging the project.

Note: Watch the output window as the project is built and deployed. The output window shows you many of the steps that VSTO takes for deploying the workflow solution - without VSTO, these are all steps that you would take manually. One of the SharePoint requirements for a new workflow solution is that the SharePoint worker process and IIS must be restarted; thus build/deploy times may vary.


58. Internet Explorer starts and displays the document library with the document(s) that you uploaded.

Note: You might encounter the following warning (below), if you do, click “No” do as it said and start again.



59.   Next Just upload a new document and will able to see the current progress:
60.   Then go Tasks List.


61.You can see a new task created above.


Go Ahead and Edit the document and you can see the status as above.

Just make it 100% complete.




And you can see that TaxWorkflow Completed...





Monday, July 11, 2011

CLAIMS BASED AUTHENTICATION in SharePoint 2010

Authentication??

Authentication, in simple English, we say “The Person is Actually the one what he/she claims to be”.

Like in Famous James Bond Series, if Black Suited, Maybach Driving guy says to you, HI I am Bond , James Bond, will you seriously going to believe him, until or unless you see his ID or “Solid Action” the same thing implies with Technology, and we have to provide a way to our websites, so that  system can authenticate this is the James actually trying to Login the Site.
Microsoft Provides for example Active Directory, in which we can create rules belongs to person and Groups and let the system recognize the access accordingly.

Suppose if James tries to login to our site and he is member of 007 Active Directory and yes it does have access to our site, so James will get access. Till the time our site is running on the basis of Active Directory to which all users of site belong we will have no issue,we don’t need Claims Based Authentication in this .

but this is not the case in General.

So where does requirement comes:


1. Sometimes Rules, Company Laws, etc doesn’t allow to capture everything and publish on the sites, means we cannot ask a user to provide all his personal information and place it on an open internet site.
Example, why a girl who is actually a lady but doesnt look too aged, like to reveal his age to anyone.

2. We work in a Network Environment, where Business Communicates with Other Business and not everyone does have the same Active Directory Authentication and even if they have then it might not be necessary that it will have the same instance of “AD”, Still organization like to provides maximum integration facilities to its users.

So here we go with Claims Based Authentication, it addresses the above challenges.

It addresses privacy and ask very less personal Information from the user and by trusting other parties or systems to do the “proof of identitycheck.

So what does Claims Based Authentication do?

Suppose we have to create a site for a “Pharma Company” which sales its medicines worldwide, called xyzPharma.

But hold on Before implementing authentication, we need to make sure that are we implementing the thing which will pass legal laws of Global Countries, take for example in U.S there are many Supplements/ Shampoos or even drugs which are banned but they are legal in Some other company, so if we have to make this implementation cut to clear then how can we do it, answer is very simple ”Claims Based Authentication”, at the same time we need not to ask who actually the person is,!



It turns out that in the country, the Government has set up a web service that users log on to, which authenticates them based on their citizenId and citizenPassword. It then is able to tell other systems that a user is their country citizen or not, without revealing who that user is.

So we implement our “xyz pharma” website by building a claims-aware system. Instead of building the standard “username and password” login mechanisms, we simply ask the Government’s web service to tell us if the user browsing our site is of which country. The claim that our system uses is a “userCountry” claim, and the claim value is either yes or no. We simply don’t build any authentication system at all beyond a simple “if (userIsofCountry) then..“ statement.


By doing this, we address privacy concerns – we don’t know or keep personally identifiable information – while at the same time ensuring that we don’t sell drugs to someone where it is banned.

Claims Based Authentication:


It actually integrates the different systems by allowing communication via open standards and does provide platform to develop more specialized “identity connectors” between systems.



How is it implemented?

The claims-based authentication implementation has a number of components. In simplified terms here’s how the pieces of technology fit together.

• From a developer’s point of view, the platform that Microsoft is providing is called the Windows Identity Foundation. This used to be called the Geneva framework. It provides a programming library suitable for building claims-aware applications. This library is also used by SharePoint 2010.


• Active Directory Federation Services implements services to create, accept, and transform tokens that contain claims.


• Cardspace provides a user interface for users to select which “identity card” they wish to use for a particular system


For More details read this very good article on Claims Based Authentication:
Claims Based Authentication-Part1

Thursday, May 26, 2011

How To add a pdf icon in Sharepoint sites

So, Why not pdf icons are included in sharepoint?
Let the answer be unspoken.
but how to add that, so when we create a doccument library, icon will appear when we upload a pdf file?

So here we go with steps.

1)Copy pdf_smallicon from adobe site.
2)Open 12\Template\Images folder
3)Paste it in that.
4)open Docicon.xml file which is over here : 12\Template\XML\Docicon.xml
5)Go to tag
6)Add this


7)Thats all, go ahead upload any pdf file now and see the magic...

LINQ to Sharepoint 2010.

LINQ (New Data Access Paradigm), when i hear it for the first time, i was sitting in a seminar and dotnet geeks were giving long lectures on it.It will make developer's life more easy.....

LINQ is a new data access paradigm which allows users to express SQL like syntax against a variety of data sources. LINQ can improve performance by allowing the back end data source to decide the best way to solve the query.
Was Amazed when used it in 2007 days for filtering CAML returned data.

CRUDQ options were allready there for maiking things good for us. but still there was something easy to implement was missing.

And finally with 2010 Microsoft given us LINQ to SharePoint.
Namespace Microsoft.SharePoint.Linq.

For people who are wondering , what is the use of it when we have CAML and more things availlable.

So for those the answer i have is its very fast, Even perform all CRUDQ options, you can bring data from multiple List and as well its very easy to write and intelliscence support we have for gettting the column names and more of the things for which we struggled alot in past looking deeper in internal names of the columns ows_xyz...

SharePoint now fully supports LINQ for querying lists so that you can query information from the platform in a more condensed, easier to understand format.



SPMETAL, the new command line utillity we have for providing the basic structure for LINQ.

In this Post i will be sharing my own experience of working with it and using LINQ to SHAREPOINT.

Writing LINQ queries are very easy but tricky things comes with SPMETAL generated code and how to use SPMETAL utillity and usage of Parameters.xml as parameter file in the command line and as well the way of utillizing the data fetched by LINQ query on EntityList.

First we will take the brief on how LINQ does the Processing(building CAML in the background and then we will come to SPMETAL and way to create the code using Parameter.xml and also i will take the case what if some fields doesnt appear the code file,how to do hard fixing(the term i normally say) )

Next i will explain, how to query with scope recurssive when querying Document Library for Folders.

In the end i will explain how to bind the data to a GridView with Template Columns to the Ienumerable list of data returned by LINQ query.