Mar 15, 2010

WSS (Windows SharePoint Services) or SharePoint

Have your Web Portals, Content Management and Business Process Management Workflows without having to pay for SharePoint just use Windows SharePoint Services (WSS) a free add-on to Microsoft Windows Server 2003 and 2008.


 
SharePoint can be adopted slowly to it's complete strength instead of being overwhelmed by the complete list of feature provided by SharePoint. Some scenarios even might not require complete SharePoint they will work just fine using only WSS.
 
WSS Features

  • Content Management system.
  • Document Management providing a central repository for shared documents
  • Web-based collaboration, collaborative editing of shared documents, and document workspaces
  • Workflows
  • Access control and revision control for documents in a library
  • Browser-based management and administration.
  • Customizable web pages using dashboards, web parts, and navigation tools
  • .... and many more

Jan 5, 2010

SharePoint Lists vs Database (RDBMS)

SharePoint is not meant to replace database, SharePoint is evolving as a "Enterprise Content Management and Collabration" Software or Application Development Platform depending on the target audience.

SharePoint List doesn't support
1) Relationship (other then simple relationships)
2) Transactions

SharePoint List supports
1) Indexing
2) Sorting
3) Filtering
4) Views

There are some third party tools (like SLAM), which helps in making relationships between lists. But keep in mind they have limitations and performance issues as SharePoint is not a RDBMS. We can't fly a passenger plane to moon, you need a rocket.

Nov 26, 2009

Branding SharePoint 2007

Branding SharePoint 2007 Site using CSS

In SharePoint CSS can exists at places:

* In the 12'hive in the core.css
* In the Theme folder of 12'hive depending on the theme
* In the Master Page itself, i.e. inline css
* Page referring custom css files
* Content editor webpart
* WebPart code behind

So what's the order of execution of the CSS at page render time (i.e. CSS inheritance).

Well, this is kinda complicated it depends upon bunch of factor:

* Ghosted/Unghosted Master Page
* Unghosting Core.css using SPD
* Making copy of layouts folder
* How the master page is deployed
and so on ...

As Thumb Rule to keeps things simple,easy and efficient, do the following:

* Inline CSS inside the MasterPage
* CSS for only certain pages, use content editor webpart

BTW, Use IE developer toolbar to see whats styles from CSS is finally applied to the page content.

Aug 12, 2009

SharePoint Custom Application Logs in the EventViewer (source code)

Custom Logging to Event Viewer by SharePoint Custom code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace My.Foo.Bar
{
public class EventLogHandler
{
static string sSource = "My Portal";
static string sLog = "Application";                   //Change it to any specific name for categorization purpose in the Eventviewer.
//static string sEvent = "Error Occurred";

public static void AddApplicationEventLog(string exceptionDetails)
{
try
{
System.Security.Principal.WindowsImpersonationContext wic =
// make impersonation = false in the code.
System.Security.Principal.WindowsIdentity.Impersonate(IntPtr.Zero);

if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);

if (!string.IsNullOrEmpty(exceptionDetails))
{
//EventLog.WriteEntry(sSource, sEvent);
EventLog.WriteEntry(sSource, exceptionDetails,
EventLogEntryType.Error, 234);
}
else
EventLog.WriteEntry(sSource, "No Error Message", EventLogEntryType.Information, 234);

// again roll back the Impersonation = true
//ExceptionManager.Publish(e);
wic.Undo();
}
catch (Exception e1)
{
//do nothing
}
}
}
}

Usage from your custom code, once you have the above class as a part of your application:

EventLogHandler.AddApplicationEventLog("Your message for event viewer");
The Event Viewer doesn't display the custom log message, if the application is not registered for the logging in the event viewer. To register your custom application with the eventviewer,
Run the following console application:

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace EventLogWriter
{
class Program
{
static void Main(string[] args)
{
try
{
string sSource = "My SP Web Portal";
string sLog = "Application";
string exceptionDetails = "Sample Entry";
try
{
System.Security.Principal.WindowsImpersonationContext wic =
// make impersonation = false in the code.
System.Security.Principal.WindowsIdentity.Impersonate(IntPtr.Zero);

if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);

if (!string.IsNullOrEmpty(exceptionDetails))
{
//EventLog.WriteEntry(sSource, sEvent);
EventLog.WriteEntry(sSource, exceptionDetails,
EventLogEntryType.Error, 234);
}
else
EventLog.WriteEntry(sSource, "No Error Message", EventLogEntryType.Information, 234);

// again roll back the Impersonation = true
//ExceptionManager.Publish(e);
wic.Undo();
}
catch (Exception e1)
{
//do nothing
}
}
catch (Exception ex)
{
}
}
}
}

Aug 3, 2009

Database Transactions in NetTier

Transactions are must when working on real time projects, always compliy with ACID properties

Try the following:

TransactionManager tran = DataRepository.Provider.CreateTransaction();
tran.BeginTransaction();
bool success = false;
try
{
// do some inserts / updates / etc
DataRepository.TicketProvider.Update(tran, ticket); //OR INSERT METHOD
UpdateSharePointLibrary(ticket.XML);
success = true;
}
Catch(Exception ex)
{
Success = false;
}
finally
{
if (success)
tran.Commit();
else
tran.Rollback();
}

If the above approach doesn't work try the one below:

try
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue))
{
//web service call
// db calls
...
scope.Complete();
}//scope

}
catch (Exception ex)
{
.....
}

Pages