Tuesday, June 16, 2009

Scheduling Custom Timer Jobs

For scheduling daily, use code like this:

SPDailySchedule dailySchedule = new SPDailySchedule();
dailySchedule.BeginHour = 0;
dailySchedule.BeginMinute = 0;
dailySchedule.BeginSecond = 0;
dailySchedule.EndHour = 23;
dailySchedule.EndMinute = 59;
dailySchedule.EndSecond = 59;

job.Schedule = dailySchedule;

That tells SharePoint to run the job any time between 00:00:00 (12:00
AM) and 23:59:59 (11:59 PM) each day. You can make this window shorter
if you need to schedule it during off-peak hours.

You can also run the job hourly using this code:

SPHourlySchedule hourlySchedule = new SPHourlySchedule();
hourlySchedule.BeginMinute = 0;
hourlySchedule.EndMinute = 59;

job.Schedule = hourlySchedule;

Or every X number of minutes using this code:

SPMinuteSchedule minuteSchedule = new SPMinuteSchedule();
minuteSchedule.BeginSecond = 0;
minuteSchedule.EndSecond = 59;
minuteSchedule.Interval = X;

job.Schedule = minuteSchedule;

The Interval is only available on the SPMinuteSchedule class. Setting
it to 15 will run the job every 15 minutes for example.

Friday, June 5, 2009

Clinic 5045: Inside Look at Developing with WSS 3.0

Was able to find time today to complete this free online self-paced course offered by Microsoft and was able to get a certificate for it. I thought that was pretty cool :) Course details and notes taken from the course can be found below:

Clinic 5045: Inside Look at Developing with Microsoft® Windows® SharePoint® Services 3.0

In this 2-hour premium clinic you will learn about the rich capabilities that Windows SharePoint Services 3.0 offers to developers. The clinic will focus on Architecture and List Management, Building and Extending Windows SharePoint Sites, and Packaging and Deploying Windows SharePoint services solutions.Having this knowledge will enable you to determine how to incorporate Windows SharePoint Services into your workspace solution development. Additionally, it will enable you to consider deployment options for your SharePoint solutions.

Objectives
At the end of the course, students will be able to:
- Describe Site and Workspace management and Document storage.
- Describe Integration with ASP.NET and Microsoft Office SharePoint Server 2007.
- Describe Sites, Lists, Content Types and Collaborative features.
- Describe Programming with WSS and using the WSS Event model.
- Describe the Property Bag and Change Log.
- Describe SharePoint Pages, Master Pages and Content Pages.
- Describe Custom Views and Templates.
- SharePoint Designer
- Describe Web parts and Workflow support.
- Describe the Administrative object model.
- Describe how to create deployable Windows SharePoint Services-based solutions.
- Describe the Feature framework.
- Describe the Solution deloyment model.

For notes taken, you may go here.

For details on how to enroll in this clinic, please refer to an earlier post entitled, "myrampup.com".

Monday, May 25, 2009

myrampup.com

from lurking within one of the blogs i have recently started to follow, i discovered this online university offering some free courses, sometimes also known as "clinics", about the many development tools, programming languages, databases, operating systems, collaboration tools and presentation frameworks Microsoft has made available to the IT world. all you need is a Windows Live ID in order to sign-up.

courses im enrolled in

most courses come with a price tag ranging from $30 to around $200, but some fortunately, are being offered for FREE. i signed up to a few which i thought would be beneficial to what i am trying to do: gain more knowledge about the MOSS 2007 platform which means understanding also the frameworks from which it was built upon (ASP.NET 2.0 and WSS 3.0) and the database system it uses for storing user content and application pages, the same system it relies upon in displaying more intelligent reports to the audience (MS SQL Server).


the online classroom

im currently taking "Clinic 5045: Inside Look at Developing with Microsoft® Windows® SharePoint® Services 3.0" and so far, im happy. i love that the content loads fast and are 80% narrated and that tool demos are available. the self-test makes the learning process exciting as well. i love that they are broken down into short-term, 2 to 6 hour courses making the completion of the course not too impossible. i love that the text can be copied from the transcripts. i love that the course teaches me the fundamentals and have an easy to follow format. i love that you can receive graduation awards upon course completion in the form of discounts on other e-learning courses and training kits. i love that its free!

Thursday, May 21, 2009

U2U for me

CAML (Collaborative Application Markup Language) is an XML-based query language that helps you in querying, building and customizing Web sites based on Windows SharePoint Services. i have used CAML in the past to add filters to my sharepoint views. today i have learned that it can be used together with SPQuery to for querying and updating lists via the SharePoint web service Lists.asmx.

CAML seems easy to learn at first, but when you work with real data and are presented with different data types having various inherent properties, the work becomes difficult. fortunately, CAML builders are available. the one i use mostly for my work is U2U CAML Query Builder.



U2U has helped me come up with nested filters having a slightly complex "where" clause (an AND and an OR). it has also helped me come up with a query that tells sharepoint to retrieve data where in "Assigned User = [Me]". lastly, it has helped me determine how the "approval status" column (used when content moderation is enabled) can be filtered. here's a sample query U2U has come up with in one of my programs:



referring to the above screenshot of U2U's UI, you can use U2U to build complex where clause by following these steps:

Select the field for which you want to add a second where condition. Click the Where checkbox. Immediately a combobox appears where you can select “And” or “Or”. Fill out or select a value and click the > button. Notice that a Where node is added to the CAML query.

Let me know if this helps!

Hashtables in a Flash

This is purely ASP.NET, but when creating custom MOSS features, this is something I have used more than a few times in order to temporarily store a subset of data coming from Sharepoint lists. Dont forget to add a reference to the System.Collections namespace beforehand.

There's nothing special about this article, just a quick reference for me.

Create a Hashtable
C#:
Hashtable objHash = new Hashtable();

VB:
Dim objHash As New Hashtable()

Add some data in it
C#:
objHash.Add("FirstName", "Asif");
objHash.Add("LastName", "Malik");
objHash.Add("Number", 1);

VB:
Dim objHash As New Hashtable()
objHash.Add("FirstName", "Asif")
objHash.Add("LastName", "Malik")
objHash.Add("Number", 1)

Search for a specific key:
C#
if (objHash.ContainsKey("FirstName"))
{
   Console.WriteLine("Key is present");
}

Loop through the items:
C#:
foreach (DictionaryEntry entry in estformsHashTable)
{
   if (entry.Value.ToString()=="")
   {
      //do something here
   }
}

VB:
Dim objEntry As DictionaryEntry
For Each objEntry In objHash
   'Do something here
Next