Article archive
Call private method from abstract class
27/09/2012 17:38
Using System.Linq;
public object InvokePrivate<T> (T instance, string methodName, params object[] obj)
{
var baseType =...
Get protected property value
27/09/2012 17:36
//Create help public class
public class Class1 : MultiPageNavigationController
{
public Class1(INavigationConfiguration config) : base(config)
{
}
//create method to get...
Create new list (splist)
25/09/2012 23:51
#Create new list on site
$Web="https://fastlanessl"
$Template="Custom List"
$Description="List pre lukasa from powershell"
$ListTitle="Lukasov list"
Start-SPAssignment -Global
$SPWeb = Get-SPWeb -Identity $Web
$listTemplate =...
Regex Get named group
25/09/2012 23:02
#We want to get list of IDs of controls in ascx file.
#get file
$path="c:\temp\demoForm2.ascx"
[regex] $regex='<asp:(textbox|label|dropdownlist)([a-zaz0-9_\ ]*)="" id="(?<idName>([a-zA-Z0-9_]*))" ' #<[:a-zAZ0-9_\...
Fill sharepoint list with lookup field
14/09/2012 23:08
function DefineLookupValue
{
param ([object]$sourceList, [string] $fieldName, [string]$value)
try
{
#prepare lookup value-getting Id of 'Section' from another...
Ternary operator
06/08/2012 19:00
First run following definition
filter Invoke-Ternary ([scriptblock]
$decider,[scriptblock]$iftrue,[scriptblock]$iffalse)
{
if (&$decider) { &$iftrue} else { &$iffalse }
}
Then set alias for...
Add web template to available web templates
02/08/2012 14:09
$siteUrl="https://fln.blogs/"
$templateName="Cham Blogs"
$site=get-spsite $siteUrl
$web=$site.Rootweb
#create object web template collection
$NewWebTemps = New-Object System.Collections.ObjectModel.Collection[Microsoft.SharePoint.SPWebTemplate]
#get all available web...
Update XSL links in .webpart file
27/07/2012 18:14
#input parameters
#$siteUrl="https://localhost/sites/events"
$destination="c:\temp"
#$fileName="NewsShortOverview.webpart"
$siteUrl=$targetUrl.substring(0, $targeturl.length-1) #got from Settings.ps1 and '/' removal
$libraryFolder="_catalogs/wp"
$libraryUrl=$siteUrl + "/" +...
Set welcome page
27/07/2012 18:11
#input parameters
$siteUrl="https://blogs/"
#$pageRelativePath = "Pages/ChamPages/RootBlogsWelcomePage.aspx"
$pageRelativePath = "Pages/default.aspx"
function SetWelcomePage
{
param([string]$siteUrl, [string]$pageRelativePath)
try
...
Approve files in library
27/07/2012 18:10
$siteUrl="https://blogs/blog3"
$web=get-spweb $siteUrl
$folder=$web.GetFolder("Pages") #("_catalogs/masterpage")
$files=$folder.Files
$layouts=@($files["NewsLayoutDetails.aspx"])
write-host "Approving...
Items: 311 - 320 of 384