Problem deleting a corrupt SharePoint 2010 List

Recently I encounted a problem in deleting a list which had apparently become corrupt.  I was unable to access the list through Central Admin, Site Settings or SharePoint designer.  Attempting to use the forcedeletelist in STSADM was also unsuccessful.

I found this useful reference:

http://blog.falchionconsulting.com/index.php/2007/11/delete-list-forget-about-forcedeletelist/

March 22, 2011 at 9:58 am 2 comments

SharePoint 2010 Dev references

This is a collection of links that I am finding useful as I research and work with SharePoint 2010:

Setting Up the Development Environment for SharePoint 2010 on Windows Vista, Windows 7, and Windows Server 2008

http://msdn.microsoft.com/en-us/library/ee554869.aspx

Site Templates and their IDs

With the SharePoint PowerShell management console (all one one line):

Get-SPWebTemplate |
select Title,Name,Description | ConvertTo-HTML | Out-File
c:\data\SPTemplates.html

http://technet.microsoft.com/en-us/library/ff607979.aspx

http://www.toddbaginski.com/blog/archive/2009/11/20/which-sharepoint-2010-site-template-is-right-for-me.aspx

List reference IDs

http://techtrainingnotes.blogspot.com/2008/01/sharepoint-registrationid-list-template.html

MSDN References

Schema description

http://msdn.microsoft.com/en-us/library/ms462947.aspx

SPListTemplateType Enumeration

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splisttemplatetype.aspx

SPMetal

http://msdn.microsoft.com/en-us/library/ee538255(office.14).aspx

http://fabiangwilliams.wordpress.com/2010/01/03/how-to-using-spmetal-utility-in-sharepoint-2010-to-presumably-manipulate-data-on-a-bcs-external-list/

Sandbox Solutions

Namespaces and Types in Sandboxed Solutions

http://msdn.microsoft.com/en-us/library/ee537860(office.14).aspx

Client Side Object Model

http://msdn.microsoft.com/en-us/library/ee857094(office.14).aspx

http://channel9.msdn.com/Learn/Courses/SharePoint2010Developer/ClientObjectModel

Workflow with Visio 2010

http://office.microsoft.com/en-us/visio-help/create-import-and-export-sharepoint-workflows-in-visio-HA101888007.aspx

http://blogs.msdn.com/b/visio/archive/2010/01/19/sharepoint-workflow-authoring-in-visio-premium-2010-part-2.aspx

March 17, 2011 at 8:46 am Leave a comment

More on PowerShell Common Parameter

Following up on how to use the Common Parameters with your own functions utlising the cmdlets such as Write-Verbose I went exploring the preference variables to see how they reacted to the switches to see if I could detect the use of the switches for my own code.  The following script is what I used to see the variables’ values change and to show that I could detect the switches being used.

function Test-CommonParameterVariables
{
[CmdletBinding()]
Param
(
[string]$switches
)
“Commandline switches: $switches`n”
“Preference Variables:”
“———————”
dir variable:\*Preference | Sort-Object -Property Name
if ($VerbosePreference -ne ‘SilentlyContinue’)
{
Write-Warning “In the VerbosePreference block”
}
if ($DebugPreference -ne ‘SilentlyContinue’)
{
Write-Warning “In the DebugPreference block”
}
}

Clear-Host
Test-CommonParameterVariables ‘No switches’
Write-Host “—————————————-”
Test-CommonParameterVariables ‘-Verbose’ -Verbose

Write-Host “—————————————-”
Test-CommonParameterVariables ‘-Debug’ -Debug

Write-Host “—————————————-”
Test-CommonParameterVariables ‘-Verbose -Debug’ -Verbose -Debug

Write-Host “—————————————-”
Test-CommonParameterVariables ‘-ErrorAction Continue’ -ErrorAction Continue

Write-Host “—————————————-”
Test-CommonParameterVariables ‘-ErrorAction Inquire’ -ErrorAction Inquire
Write-Host “—————————————-”
Test-CommonParameterVariables ‘-ErrorAction Stop’ -ErrorAction Stop
Write-Host “—————————————-“

February 25, 2011 at 4:35 pm Leave a comment

Using Common Parameters in PowerShell

I have been exploring how the Common Parameter functionality gets used in custom code.  Basically it looks as though you need to use the CmdletBinding attribute to have the Common Parameters bound to your function, which means that you need to have parameters for this to work.  Then you have to use cmdlets such as Write-Verbose to hook in the the in built support for the Common Parameters.

The following code is what I have been using to check the functionality:

###############################################
# Script to explore common parameters
# Brent Challis
# Dimension Data Learning Solutions
# Melbourne, Victoria, Australia
###############################################
function Test-CommonParametersWithCmdletBinding
{
[CmdletBinding()]
Param
(
[string]$FunctionMessage = “Initial Value”
)
Write-Output “Starting Function with CmdletBinding.”
Write-Host “Writing to the host.”
Write-Output $FunctionMessage
Write-Verbose “Verbose message.”
Write-Debug “Debug message.”
Write-Warning “Warning message.”
Write-Output “Function Complete.”
}

function Test-CommonParametersWithoutCmdletBinding
{
Param
(
[string]$FunctionMessage = “Initial Value”
)
Write-Output “Starting Function without CmdletBinding.”
Write-Host “Writing to the host.”
Write-Output $FunctionMessage
Write-Verbose “Verbose message.”
Write-Debug “Debug message.”
Write-Warning “Warning message.”
Write-Output “Function Complete.”
}

Clear-Host
Write-Host “Starting.”
Write-Host “==========================================================”
Write-Host “Getting help info”
Get-Help Test-CommonParametersWithCmdletBinding
Write-Host “———————————————————-”
Get-Help Test-CommonParametersWithoutCmdletBinding
Write-Host “==========================================================”
Write-Host “Run with CmdletBinding.”
Test-CommonParametersWithCmdletBinding “Test Message” -Verbose -Debug
Write-Host “==========================================================”
Write-Host “Run without CmdletBinding.”
Test-CommonParametersWithoutCmdletBinding “Test Message” -Verbose -Debug
Write-Host “==========================================================”
Write-Output “Test complete.”

February 23, 2011 at 10:30 am Leave a comment

Warming up a SharePoint 2010 Server with PowerShell

In looking for an updated way to warm up SharePoint 2010 sites to improve the user experience I cam across a PowerShell script at the following site:

http://nearbaseline.com.au/blog/2010/02/powershell-warmup-script-2/

############################################################################
#WarmUp2.ps1 – Enumerates all web sites in web applications in a 2010
# SharePoint farm and opens each in a browser.
#Notes:
#-“get-webpage” function borrowed from:
# http://kirkhofer.wordpress.com/2008/10/18/sharepoint-warm-up-script/
#
#Assumptions:
#-Running on machine with WSS/MOSS 2010 installed
############################################################################

Add-PsSnapin Microsoft.SharePoint.PowerShell
$extrasitelistfile = ‘c:\Tools\Warmup\warmup-extrasites.txt’

function get-webpage([string]$url,[System.Net.NetworkCredential]$cred=$null)
{
$wc = new-object net.webclient
if($cred -eq $null)
{
$cred = [System.Net.CredentialCache]::DefaultCredentials;
}
$wc.credentials = $cred;
return $wc.DownloadString($url);
}

#This passes in the default credentials needed. If you need specific
#stuff you can use something else to elevate basically the permissions.
#Or run this task as a user that has a Policy above all the Web
#Applications with the correct permissions

$cred = [System.Net.CredentialCache]::DefaultCredentials;
#$cred = new-object System.Net.NetworkCredential(“username”,”password”,”machinename”)

$apps = get-spwebapplication -includecentraladministration
foreach ($app in $apps) {
$sites = get-spsite -webapplication $app.url
foreach ($site in $sites) {
write-host $site.Url;
$html=get-webpage -url $site.Url -cred $cred;
}
}
# Warm up other sites specified in warmup-extrasites.txt file (such as SSRS)

if (test-path $extrasitelistfile) {
$extrasites = get-content $extrasitelistfile
foreach ($site in $extrasites) {
write-host $site;
$html=get-webpage -url $site -cred $cred;
}
}

February 17, 2011 at 12:34 pm Leave a comment

C# MessageBox with Time Out

In an application that I am currently working on I need to have a MessageBox display a warning to users, but wanted it to close down after a time delay if the user did not click the OK button.  This is functionality that I had in the Shell.Popup in my VBScript work, so simply reused that functionality.

I did this by adding a reference to the IWshRuntimeLibrary by selecting Add reference and from the COM tab, selecting the Windows Script Host Object Model.

Then in my code simply put:

IWshRuntimeLibrary.WshShellClass wshShell = new IWshRuntimeLibrary.WshShellClass();

wshShell.Popup(“The Master version has shut down, so this instance needs to close as well.”, 10, “Master Instance of GhostCaster has closed”);

 

December 23, 2010 at 7:47 am Leave a comment

PowerShell_ISE utility function to add help tags

The following is a utility function that adds a tag structure to make it easier to add help to your functions to be displayed by the Get-Help Cmdlet.

<#
.SYNOPSIS
  Inset tags to support the Get-Help Cmdlet
.DESCRIPTION
  Insert-FunctionHelpText inserts text at the current cursor position to provide
  a skeleton of tags which can then be edited to provide support for the function
  and the Get-Help Cmdlet.
.NOTES
  This is a useful function to be called from a menu added to the PowerShell-ISE
  Add-ons menu structure. 
.EXAMPLE
  Insert-FunctionHelpText
#>
function Insert-FunctionHelpText()
{
$psISE.CurrentFile.Editor.InsertText("<#
.SYNOPSIS
  Brief description of function.  Start with a verb.
.DESCRIPTION
  Full description of the function.  Start with <function name>
.PARAMETER parameterName
  Description of parameter
.INPUTS
  List .NET classes the function will accept as input.
.OUTPUTS
  List .NET classes the function will output.
.NOTES
  List information that does not easily fit into other parts of the structure.
.LINK
  about_function
.EXAMPLE
  function-name -parameter
#>
")
}

September 29, 2010 at 2:19 pm Leave a comment

Older Posts Newer Posts


Categories

  • Blogroll

  • Feeds