We create an application which searches the SharePoint log for events matching correlation guids it finds on the clipboard. I.e. copy the correlation ID SharePoint gives you, switch to this application, and enjoy.
This post explains how you can run a (SharePoint) Powershell command from C#/SharePoint.
In this second part, we show how we can build an xml structure from information we get from SharePoint. This xml can later be edited, and used as input to the SharePoint creator from part i.
In this two-part series, we show how we can (easily) create large SharePoint structures using Powershell and xml - and hashtables(!?)
In which I show how you can write CAML queries that are understandable, and show how you can query from Powershell.
Starting timer jobs from Powershell is easy.Get the job, execute:$webApp = Get-SPWebApplication "http://$($env:computername... = $webApp.JobDefinitions | Where-Object { $_.Name -eq "<timer job name>"}$job.Execute([Sys... # In my timer job I don't actually use the guid, so just create a new oneWrite-Host "Done."...mostly as a reminder to myself. :-) ......
It is frequently useful to create / delete web applications in a development environment. If you need to create a structure, this can quickly become tedious. Enter Powershell, xml and recursive functions. Create the structure in xml. Something like: <Sites> <Site Name="Test 1" Url="Test1" /> <Site Name="Test 2" Url="Test2" > <Site Name="Test 2 1" Url="Test21" > <Site Name="Test 2 1 1" Url="Test211" /> <Site Name="Test 2 1 2" Url="Test212" /> </Site> </Site> ......
Creating nested progress dialogs in Powershell is easy. Let the code speak for itself: for ($i = 1; $i -le 2; $i++) { Write-Progress -ID 1 -Activity "Outer loop" -Status "Tick $i" -percentComplete ($i / 2*100) for ($j = 1; $j -le 3; $j++) { Write-Progress -ID 2 -Activity "Mid loop" -Status "Tick $j" -percentComplete ($j / 3*100) for ($k = 1; $k -le 3; $k++) { Write-Progress -ID 3 -Activity "Inner loop" -Status "Tick $k" -percentComplete ($k / 3*100) Sleep(1) } } } I.e. some text that explains what ......
Add a simple PowerShell script to your presentations to cache pages you're about to demo.
SharePoint 2010 developers love Powershell. It really is a huge step forward. If you still haven't started to use it, do so. But I got bit the other day, when I added a try-catch block to my code. See if you can spot it: Try { $legen = Create-Object Reidar.Husmo.AwesomeClass $legen.Dary(42) } Catch { "an error occurred" } As you no doubt immediately spotted, Powershell does not have a Create-Object. But the try-catch hides coding mistakes. There is no indication that things are not ok, not even "an ......