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

InfoPath 5337 error

Error: 04/01/2013 08:43:41.45  w3wp.exe (0x0C78)        0x229C  InfoPath Forms Services               Runtime – Business Logic              7tge                Medium               Exception thrown from business logic event listener: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventExternal.<>c__DisplayClass10.<add_Changed>b__c(Object sender, XmlEventArgs e)     at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventExternal.<>c__DisplayClass20.<FireChangedEvent>b__1c()     at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)            0ba576c2-222a-4d18-bc06-7fab0ce977a1

Pointers:

1)      Check for unwanted change events

2)      Check for unwanted data connections

3)      Check for unwanted fields on the form

Resolution:

I was able to fix the issue by deleting the changed event under FormCode.cs (an extra event that got created when I accidentally double-clicked on a field on the form).