Monday, July 27, 2009

Creating a Sharepoint Theme

  1. Copy and rename the existing theme.
  2. Rename the info file of the theme with the given name of the copied folder.
  3. Open the .inf file and replace the titles.
  4. Customize colors, fonts and so on in the style sheets of the theme.
  5. Add your own images to the theme.
  6. Create a thumbnail and copy it to the 12\TEMPLATE\Images folder.
  7. Add theme definition in the SPTHEMES.xml in the 12\TEMPLATE\Layouts\ folder.

SharePoint List Template Id’s

When creating SharePoint 2007 receivers, the ListTemplateId attribute is associated with a “value” that is an optional unique identifier for the target template for which the receiver is being built. The value of templates are as shown below.
ValueDescription
1200Administrator tasks list
104Announcements list
303Blog Categories list
302Blog Comments list
301Blog Posts list
105Contacts list
120Custom grid for a list
118Custom Workflow Process
130Data Connection library
110Data sources
108Discussion board
101Document libraryaEvents list
150Gantt Tasks list
100Generic list
1100Issue tracking
103Links list
114List template gallery
116Master pages gallery
201Meeting Agenda list
202Meeting Attendees list
204Meeting Decisions list
207Meeting Objectives list
200Meeting Series list
210Meeting text box
211Meeting Things To Bring list
212Meeting Workspace Pages list
117No-Code Workflows
2002Personal document library
109Picture library
300Portal Sites list
2003Private document library
111Site template gallery
102Survey
107Tasks list
112User Information list
113Web Part gallery
119Wiki Page library
140Workflow History
115XML Form library

Friday, July 24, 2009

Introducing Master Pages in Sharepoint

* Central file controlling the layout and design of the content pages in a sharepoint site
  • Title, logo and description of the site
  • Navigation controls
  • Welcome and Administration
  • Search experience
  • Linking cascading style sheet(CSS) files and script files
  • Web part Manager
  • Contentplaceholders for sharepoint products and technologies

Setting Master pages programatically

  • Execute code to switch to new provisioned Master page
  • Feature Receiver

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWeb site = Properties.Feature.Parent as SPWeb;
Site.Properties["OriginalMasterPage"] = site.MasterUrl;
site.Properties.Update();
site.MasterUrl="/_catalogs/masterpage/Litware.master";
site.Update();
}

CSS Files

  • CSSLink control loads core.css file
  • Override Styles
  • with an Explicit embedded <style> element
  • programitically setting the AlternateCSSUrl property of the SPWeb
    Public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
    SPWeb site = properties.Feature.parent as SPWeb;
    site.AlternateCSSUrl="/_layouts/LitwareCSS/LitwareCore.css";
    site.Update();
    }

    Thursday, July 23, 2009

    Singleton Pattern

    Using System;
    Using System.Text;
    Namespace Singletonproject
    Class Singleton
    {
    Private Datetime CreatedDateTime;
    Private Singleton
    {
    CreatedDateTime = System.DateTime.Now;
    }
    Private static Singleton instancia = null;
    Private Object Padlock = new object();
    Public Singleton Instancia
    {
    get{
    if(instancia==null)
    instancia= new Singleton();
    return instancia;
    }
    }
    Public string GetDateTime
    {
    return CreatedDateTime.Tostring();
    }
    Calling procedure
    Singletonproject.Singleton clsc= Singletonproject.Singleton.Instancia;
    Label1.text = clsc.GetDateTime.Tostring();

    Finding the Id (Guid) for a SharePoint List

    * Navigate to the SharePoint list using the browser.
    * Select the Settings + List Settings menu command.
    Copy the Url from the browser address bar into Notepad. It will look something like: http://moss2007/ProjectX/_layouts/listedit.aspx?List=%7B26534EF9%2DAB3A%2D46E0%2DAE56%2DEFF168BE562F%7D
    Delete everying before and including “List=”.
    Change “%7B” to “{”
    Change all “%2D” to “-“
    Chnage “%7D” to “}”
    You are now left with the Id:
    {26534EF9-AB3A-46E0-AE56-EFF168BE562F}

    Thursday, July 16, 2009

    LINQ

    C# 3.0 includes many strong new features, but one of the most interesting is the inclusion of its new query keywords, that you use to create Query Expressions. Query Expressions are most commonly associated with Language Integrated Query (LINQ). They're the core syntax that you'll use when you create LINQ queries, whether you use LINQ to Objects, LINQ to SQL, LINQ to XML, or some other custom LINQ provider. I'll discuss the query keywords, how those keywords map to methods defined using the query operands, and how you can define your own custom implementation for the query keywords. The C# team worked to minimize the necessary grammar for LINQ and the associated query syntax. They ended up adding eight contextual keywords to the C# language specifically for query: from, where, select, group, into, orderby, join, and let.

    int[] someNumbers = { 2, 3, 7, 11, 13, 17, 19 };
    var query = from number in someNumbers

    someNumbers is the datasource, and number is the range variable. The datasource must implement IEnumerable, or IEnumerable. In this example, someNumbers implements IEnumerable. The compiler gives the range variable a type to match the type enumerated by the datasource. In the example above, number will be an integer. In general, the range variable is of type T, whenever the datasource implements IEnumerable. In the case where the range variable implements IEnumerable, the range variable is a System.Object. You never need to declare the type of the range variable; the compiler infers it. Consider you have the following string array
    string[] names = { "Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" };
    Task is to take the name which has length greater than 5 and make them capital letter. if we go in normal way we will put a for loop and then call it and assign a temp variable fetch it out hmmm lot of steps lets see how LINQ works on this

    LINQ syntax
    var query = from s in names where s.Length == 5 select s.ToUpper();

    simple rite it looks like T-SQL but in the reverse way don't confused. in T-SQL you know that you are going to query either a table or view but in LINQ you are going to query a object so you dont know from where you are going to query to from comes first instead of select

    Friday, May 8, 2009

    Explicit cursors in PL/SQL procedures

    /* Use of Explicit cursor in procedures is shown in the below example. */ Create or replace procedure SP_EMP is
    cursor Emp_cur is select empno,ename from EMP;
    Emp_cur_var emp_cur%RowType;
    begin
    open Emp_cur;
    loop
    Fetch Emp_cur into Emp_cur_var;
    exit when Emp_cur%NotFound;
    dbms_output.put_line(Emp_cur_var.empno' ' Emp_cur_var.ename);
    endloop;
    close Emp_cur;
    end SP_EMP;