All SPQuery examples
Query for Date type Column in SharePoint
The above query is to find the items which has Date column with value less than Today's Date. The results will be returned in a Descending manner so you can get the most recently entered items from the List.
Query on Date Yes\No columns :
Monday, March 31, 2008
SPQuery Examples
Thursday, March 27, 2008
Deploy Webpart as Solution Package and Feature
A quick and easy way is to create a WebPart using VseWSS extenstions. This will create all the files needed for deploying your webpart including elements.xml, feature.xml, manifest.xml along with your solution package i.e. .wsp file.
For Step-by-Step explanation See :
Create and Deploy Webpart as Solution Package and Feature
Tuesday, March 25, 2008
Useful Links for changing Look and Feel
Creating User control in master Page :
Add user control in sharepoint master page
Swtich Master Page according to logged in users group.
Switch SharePoint master page for logged in user
SPSiteDataQuery

You Can query multiple lists/Libraries of same kind for common fields in them. This Query returns a Datatable,which can be used as a source to a Calendar or GridView etc.
Query above will serach all the lists(Specified by Basetype = '0') for column name "EventDate" and value as Today's date. And returns Title , EventDate,Description,ListName(custom field in event List) in a form of a Table.
You can also Specify the List's to search in the scope! You need to provide the Guid of the List for that .
Sunday, March 23, 2008
Custom Calendar Webpart,With colors
Please see my post at theSharePointmarket.com. I also have added the missing CAMl query. Click the link below for full code.
Custom Calendar WebPart
Tuesday, March 18, 2008
User control in Master Pages
Adding a user Contol in a master page is quite easy and is useful too. I have once added the control in the master page for changing the links in quick launch bar and once, for creating a custom footer in the master page .
I have added a post at my new website with detail screenshots which explains the procces to add a link in the master page with user control. Please see the link below.
Add user control in sharepoint master page
Sunday, March 9, 2008
Download Calandar Webpart, Displays Event Details OnMouseOver
Calendar Web Part enables you to view all schedules in a compact and comfortable view. See all your appointments by putting the mouse over the day you are interested in. Calendar Web Part may be connected to any list on WSS 3.0/MOSS 2007 site.
You Can download from : http://software.techrepublic.com.com/download.aspx?&q=Sharepoint+Calendar+Web+Part+%28zip%29&docid=333854&promo=100511
Saturday, March 1, 2008
State Machine Workflow - Preparing Association & Initiation Forms
There are two types of workflow Sequential and State Machine, to know more see :Types of Workflows
In this example I will make a Simple State Machine Workflow with Three Infopath forms and Three states. This workflow will take the name of the Approver in Association form,and then When invoked on a Item,displays a Initiation form to add Comments with the item and will create a Task for the Approver/Manager defined in Association form for Approval. If Approver Approve's the task then the workflow is said to be complete or else will be in InProgress.
Contents :
We have Three States in this State machine Workflow.
1) Start State
2) Manager Review State
3) Final State.
And Three Infopath Forms Which are:
1) Association form - For getting the name of Approver.
2) Initilazion form - For adding Comments To the item
3) Task(Review) form - To display for Approval.
Now Lets Get Started, We will first Create an Association, Intitiation and Task Review Form in Infopath 2007.
Steps:
1. Create an Infopath Form,click Design a form and then Choose a Blank Form.
Imp: Make sure that the form is Browser Enabled, i.e the little checkbox displayed below the blank form is checked.
2. Now Design the form with a One table Layout and Name it Association form(You can name it something meaningfull).
3. Now Lets create the DataSource. Firstly double click on myfields and Rename as Main.
4. Add Two Fields Approve and Comments as Text to the Main datasource and drag the Approve field to the form. Create a button “Ok” as below(image).Your Infopath Form looks like this:.bmp)
So, To do this we added a Comments field here in this form, just to make an Entry for it in Association form Schema.
We will Create a Class file from this Association fom Schema and will add it into our Workflow.
6. Now double click on OK button and Add a rule for it. Then Add Action. In the action dialog, select Submit using a data connection from the dropdown list.Click Add and on the next screen, choose to create a new connection to submit data.
10. Now To create a Class file from association form Schema right click File menu, and chose Save as source.
11. Choose a folder Source(make new folder) and then ok.
12. Now we will create a class file to be used in workflow.
13. Open the Visual studio Command prompt, and move to the path of Source folder.
14. Now write the command xsd myschema.cs /c to generate class file from association form schema.
Lets Create an Initiation form now.
Repeat the first three steps above and then create a single field under Main as Comments.
Drag it on to the form. Create a Submit button from controls and repeate step from 6 to 9. .bmp)
Last form is the Taks Form/Review Form.
Steps:
Create a form with title “Manager review”.
Now create a dtasource and add a Yes/No filed. This is a checkbox to tell the document is approved. Name the field as Approve.
Create a button ok and repeate stepts 6 to 9 to create a rule for button and finally Save and Publish the form..bmp)
We are ready with the Infopath forms Now.

