Tuesday, April 20, 2010

Creating SharePoint 2007 Timer Jobs

I was searching for some articles on how to Create Sharepoint 2007 Timer Jobs - and i found some nice ones, Andrew is describing it very well on his articles - Check out.
http://www.andrewconnell.com/blog/archive/2007/01/10/5704.aspx
http://www.andrewconnell.com/blog/archive/2008/04/15/More-help-on-creating-custom-timer-jobs-and-a-useful.aspx

How to Use CAML Query to get Data from SharePoint 2007 List

Simple Products List in SharePoint 2007. The list was pretty simple with 2 columns "Product" and "Cost". I used U2U to create a pretty descent CAML query. I created a simple website in VS2008 to test it !!! It all worked fantastically!!!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;

namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SPList mylist=new SPSite ("http://sharepointblog").OpenWeb ().Lists ["Products"];
SPQuery query=new SPQuery ();
query.Query = "";
SPListItemCollection items=mylist.GetItems (query);

foreach (SPListItem proditem in items )
{
Response.Write(proditem["Title"].ToString ());
Response.Write(proditem["Cost"]);

}


}
}
}