Same Old Question….Abstract Class & Interface

Abstract Class: Cannot be instantiated, contract that forces all the subclasses to carry on the same hierarchies or standards

Interface: No Implementation, When we create an interface, we are basically creating a set of methods without any implementation that must be overridden by the implemented classes

A class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t support multiple inheritance, interfaces are used to implement multiple inheritance.

When we create an abstract class, we are creating a base class that might have one or more completed methods but at least one or more methods are left uncompleted and declared abstract. If all the methods of an abstract class are uncompleted then it is same as an interface. The purpose of an abstract class is to provide a base class definition for how a set of derived classes will work and then allow the programmers to fill the implementation in the derived classes.

http://www.aspdotnet-suresh.com/2010/04/abstract-versus-interface.html

Ajax

AJAX is a developer’s dream, because you can:

  • Update a web page without reloading the page
  • Request data from a server – after the page has loaded
  • Receive data from a server – after the page has loaded
  • Send data to a server – in the background

ajax

AJAX = Asynchronous JavaScript And XML.

AJAX is not a programming language.

AJAX just uses a combination of:

  • A browser built-in XMLHttpRequest object (to request data from a web server)
  • JavaScript and HTML DOM (to display or use the data)

AJAX allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

 

Powershell script to export list view data to spreadsheet

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$SiteUrl=”http://sharepoint/sites/co”
$ListName = “Pipeline”
$ViewName = “All Items”

#Get Web and List objects
$web = Get-SPWeb $SiteURL
$list = $web.Lists[$ListName]

#Get the View
$view = $list.Views[$ViewName]

#Get All Items from the View
$items = $list.GetItems($view)
$view.rowlimit = 100000

#This will temporarily update the view row limit – it gets set back to 30 at the end of the script

$view.update()
$vfields=$view.viewfields
$lfields=$list.fields
$efields=@()
foreach($vf in $vfields)
{
foreach($lf in $lfields)
{
if($lf.internalname -eq $vf)
{
$efields += $lf.title
}
}
}

$items = $list.getitems($view)
if($items.count -gt 0)
{
$exportlist = $null
$exportlist = @()
$items | foreach {
$hash = $null
$hash = @{}
foreach($ef in $efields)
{
$hash.add($ef, $_[$ef])
}
$obj = New-Object PSObject -Property $hash
$exportlist += $obj
}
$sel=@()
foreach($efield in $efields)
{
$sel+=$efield
}
$expath = ‘D:\ExportLV.csv’
$exportlist |select $sel | Export-Csv -path $expath -notypeinformation
$view.rowlimit = 30
$view.update()
}

$web.dispose()

SharePoint 2010 Calendar View: Hide End time, Remove ToolTip

Add a CEWP and add the below script as HTML Source.

// Created a new column on xRM Task list that concatenates the
// Due Date and Due Time into a single Date/Time field.
// Use the new Date/Time field in the Calendar view configuration as start/end date
// Use jQuery to:
// – change the monthly calendar time range displays (e.g., 3:30 pm – 3:30 pm)
// such that only a single time displays. There is no begin and end date/time
// field in the xRM Task list. Steve will use the Due Date and Due Time to track his activities.
// – Make the same change to tooltips.
// – link to edit form instead of display form. Return automatically to calendar
// the “populateCalendarEventLinkIntercept” technique came from Mike Smith:
// http://techtrainingnotes.blogspot.com/2010/06/sharepoint-2010-color-coded-calendars.html
// this technique handled all calendar view changes (day-week-month; previous/next)
// except the “n more Items” and “collapse” links when more than 3 items are on a month day.
//
// the setTimeout technique was suggested by Marc Anderson.
// it handles the more/collapse scenario
// load our function to the delayed load list
// but do not do this if page is in “Edit” mode

_spBodyOnLoadFunctionNames.push(‘populateCalendarEventLinkIntercept’);

// hook into the existing SharePoint calendar load function
function populateCalendarEventLinkIntercept()
{

if (SP.UI.ApplicationPages.CalendarNotify.$4a) // 20111006 pre-SP1 – Office 365
{
var OldCalendarNotify = SP.UI.ApplicationPages.CalendarNotify.$4a;
SP.UI.ApplicationPages.CalendarNotify.$4a = function ()
{
OldCalendarNotify();
doModifyCal();
}
}
if (SP.UI.ApplicationPages.CalendarNotify.$4b) // SP2010 SP1
{
var OldCalendarNotify = SP.UI.ApplicationPages.CalendarNotify.$4b;
SP.UI.ApplicationPages.CalendarNotify.$4b = function ()
{
OldCalendarNotify();
doModifyCal();
}
}
// future service pack change may go here!
// if (SP.UI.ApplicationPages.CalendarNotify.???)

}
// }

function doModifyCal() {
// get text “Previous Month” or “…Week” or “…Day”
var dateUnit = $(“#AsynchronousViewDefault_CalendarView a[title^=’Previous’]”).filter(“:first”).attr(“title”);
// remove “Previous ” from text, leaving only “Month”, “Week” or “Day”
dateUnit=dateUnit.substring(dateUnit.indexOf(” “)+1);
// if there is a more/collapse control (which happens when there are more than three items on month date)
// set its click event to execute this doModifyCal function.
// include a pause to allow for latent data population from separate asynchronous thread
if ($(“a.ms-cal-nav”).eq(0).length) {
$(“div.ms-acal-ctrlitem”).eq(0).click(function() {
window.setTimeout(doModifyCal, 0);
});
}
// if there is at least one non-reformatted time display, clean it up
// A dash in the title signifies that this has not yet been reformatted
// well – not really. I’ll refine this later. The dash would have to be
// within the first 7 characters: hh:mm – hh:mm
var str=””;
var y=$(‘div.ms-acal-rootdiv:eq(1) div[title~=”-“]’).filter(“:first”);
if(y.length) {
var urlString = urlencode(location.href);
var CalData = $(‘div.ms-acal-rootdiv’).eq(1);
$(‘div[title]’, CalData).each(function() {
str=$(this).attr(“title”);
str=str.slice(str.search(“-“)+2); // remove begin time from all link tool tips
$(this).attr(“title”,str);
});
if(dateUnit==”Month”) {
//check for and remove begin time from single-item-per-day times
$(“div.ms-acal-time”).each(function() {
str=$(this).text();
str=str.slice(str.search(“-“)+2);
$(this).text(str);
});
}

// additionally, replace the onclick action of each task item’s link such that a modal Edit form
// will pop up instead of modal Display form. This involves creating a new function that
// calls SP.UI.ModalDialog methods made available to SP2010 through the EcmaScript Client Object Model
// ref – http://msdn.microsoft.com/en-us/library/ff410259.aspx
//
// do not include “more/collapse” link
//
// For clarification purposes we are going to:
//
// change this:
// task title
//
// to this:
// task title
//
var Links = $(“a:not(.ms-cal-nav)”, CalData);
Links.each(function() {
str=$(this).attr(“href”);
str=str.replace(“DispForm”,”EditForm”);
$(this).attr(“href”,”javascript:void();”).attr(“onclick”,”modalEdit(‘” + str + “‘);return(false);”);
});
}
}

function callBackRefresh(dialogResult, returnValue) {
var calDetail2 = $(“#AsynchronousViewDefault_CalendarView > div.ms-acal-rootdiv > table”)
.filter(“:first”)
.attr(“summary”);
}

// We are here because someone clicked on a task item link in one of the
// calendar views.
//
//
function modalEdit(page) {
var options = {
url: page,
title: ‘Edit Task’,
allowMaximize: false,
showClose: true,
dialogReturnValueCallback: callBackRefresh,
autoSize: true
};
SP.UI.ModalDialog.showModalDialog(options);
}
function urlencode(link) {
link = encodeURI(link);
link = link.replace(‘+’, ‘%2B’);
link = link.replace(‘%20’, ‘+’);
link = link.replace(‘*’, ‘%2A’);
link = link.replace(‘/’, ‘%2F’);
link = link.replace(‘@’, ‘%40’);
return link;
}

Source: http://office.microsoft.com/en-us/sharepoint-server-help/create-a-calendar-view-for-an-existing-list-HA103954476.aspx