Monthly Archives: June 2011

declarative workflow does not start automatically for new item or item changed


See this http://support.microsoft.com/kb/947284

If you create a workflow to start automatically on creation of a new item or a change in the item – it may not start if the following conditions are true:

  1. The Windows SharePoint Services Web application runs under a user’s domain account.
  2. The user logs in by using this domain account.
  3. The site displays the user name as System Account.

A change to the service accounts is required – or you need to login as another user.

Typically you will face this in your individual development environment as you are most likely using one account for everything.

powershell : create list + add columns + set new default view


Had to create custom list using powershell + add columns + create a new view + set that as a default view. For the longest time, the default view just would not be set – no errors, till it dawned that I need to update the view once it is set to default (and not just update the list).

I could also not find a relevant example to add declared columns to a new view (within msdn or google), so including that as well. Check the two lines in bold below.

Here is an example:


#
$webURL = “http://spurl/site/”
$spSite = [Microsoft.SharePoint.SPSite]($webURL)
$spWeb = $spSite.OpenWeb()
#
# Create a custom list (ID is 100)
$myListGuid = $spWeb.Lists.Add(“CustInfo”, “Customer Information for Northern Projects”, 100)
$myList = $spweb.Lists[$myListGuid]
#
# Update the List Title
$myListObj = $spWeb.Lists[“CustInfo”]
$myListObj.Title = “Customer Information”
$myListObj.Update()
#
# Adding fields
$myFieldCustomerName = $myList.Fields.Add(“CustomerName”, “Text”, 0)
$myList.Fields[$myFieldCustomerName].Title = “Customer Name”
$myList.Fields[$myFieldCustomerName].Update()
#
# Adding fields
$myFieldCustomerAvailable = $myList.Fields.Add(“CustomerAvailable”, “Boolean”, 0)
$myList.Fields[$myFieldCustomerAvailable].Title = “Customer Available”
$myList.Fields[$myFieldCustomerAvailable].Update()
#
# Adding fields
$myFieldCustomerDate = $myList.Fields.Add(“CustomerDate”, “DateTime”, 0)
$myList.Fields[$myFieldCustomerDate].Title = “Customer Date”
$myList.Fields[$myFieldCustomerDate].DisplayFormat = “DateOnly”
$myList.Fields[$myFieldCustomerDate].Update()
#
# Setting the Query for the View
$viewQuery = “<OrderBy><FieldRef Name=””Modified”” Ascending=””False”” /></OrderBy>”
#
# Adding fields to the view
$viewFields = New-Object System.Collections.Specialized.StringCollection
$viewFields.Add(“Attachments”)
$viewFields.Add(“LinkTitle”)
$viewFields.Add($myFieldCustomerName)
$viewFields.Add($myFieldCustomerDate)
#
# View Name
$viewName = “view_name_here”
#
# Finally – Provisioning the View
$myListView = $myList.Views.Add($viewName, $viewFields, $viewQuery, 100, $True, $False, “HTML”, $False)
#
# You need to Update the View for changes made to the view
# Updating the List is not enough
$myListView.DefaultView = $True
$myListView.Update()
#
$myList.OnQuickLaunch = $True
$myList.Update()
#
$spWeb.Dispose()
$spSite.Dispose()

SharePoint – Start and Stop on Development Machine


If you are using your laptop / desktop as a SharePoint Development Environment, and then ocassionally “dont” want to work with SharePoint, here is an easy way to free up local resources (CPU/memory/etc).

The following “windows services” are associated with my SharePoint instance (note the default status as Automatic/Manual/Disabled).

I updated the Automatic to Manual.


Once they are all setup as Manual, use the following to fire up or shut down any of these (in the order) from an elevated command prompt.

To START:

net start SQLWriter
net start SQLBrowser
net start MSSQL$SHAREPOINT
net start SQLAgent$SHAREPOINT
net start W3SVC
net start SPAdminV4
net start SPTimerV4
net start SPTraceV4
net start OSearch14
net start WebAnalyticsService

To STOP:

net stop W3SVC
net stop SPAdminV4
net stop SPTimerV4
net stop SPTraceV4
net stop OSearch14
net stop WebAnalyticsService
net stop SQLAgent$SHAREPOINT
net stop MSSQL$SHAREPOINT
net stop SQLBrowser
net stop SQLWriter

Load control template file /_controltemplates/TaxonomyPicker.ascx failed


If you find the following in the ULS error:

Load control template file /_controltemplates/TaxonomyPicker.ascx failed: Could not load type ‘Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker’ from assembly ‘Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’.
<pre>Edit C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\TaxonomyPicker.ascx

Find the character stringĀ , and replace with a comma “,” (without quotes). Change “Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker,” to “Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker,”
This has been documented at http://support.microsoft.com/kb/2481844