Article archive

Remove Illegal characters from filename

16/11/2012 17:13
$file = "this*file\\i?.txt" $file $pattern = "[{0}]" -f ([Regex]::Escape([String][System.IO.Path]::GetInvalidFileNameChars())) $newfile = [Regex]::Replace($file, $pattern, '-') $newfile

Content Query Web Part - Identity Transform

16/11/2012 10:03
open the ContentQueryMain.xsl file in your favourite XSL editor or text editor, and locate the template root node Change the inner XML of this node to dump out the xml content by surrounding it in TEXTAREA tag   <xsl:template match="/">     <TEXTAREA...

Display URL field in Content Query Web Part

15/11/2012 10:23
URL field is sending from Content Query Web Part (via CommonViewFields property). We want to display it as it is in a list, description text with link. We have to split Url value which is sent as: url, description. That's why it's parsed to variables.   <xsl:stylesheet  ...

Add list items to existing sharepoint list declaratively

14/11/2012 10:24
Put the same Title, TemplateType, Url xml version="1.0" encoding="utf-8"?> <Elements xmlns="https://schemas.microsoft.com/sharepoint/"> <ListInstance Title="Reusable...

Create Publishing Page by Powershell

14/11/2012 09:03
#input parameters $siteUrl="https://mySiteCollection" $fileName = ...

Create an instance of object in powershell

14/11/2012 08:46
#in csharp it is: using Microsoft.SharePoint [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint")    #this represents: SPFieldUrlValue field = new SPFieldUrlValue(); in csharp $field=new-object...

Create task in task scheduler

14/11/2012 07:57
#Create task to repeat every 2 hours from now (it's set as 'Once' and every 2 hours indefinitely) schtasks /create /sc hourly /mo 2 /tn "Task Name" /tr "PowerShell -command c:\pathToScript\ScriptFileName.ps1"

Set farm property

14/11/2012 07:50
#input parameters $propertyName="SomePropertyName" Add-pssnapin microsoft.sharepoint.powershell -ea 0 $farm=$null $property=$null Start-SPAssignment -Global $farm=Get-SPFarm $property=$farm.Properties[$propertyName]   #Set value if($property -ne...

Get Powershell version

12/11/2012 08:50
$host #or $host.Version #or $PSVersionTable Name Value ---- ----- WSManStackVersion 3.0 PSCompatibleVersions {1.0, 2.0, 3.0} SerializationVersion 1.1.0.1 BuildVersion 6.2.9200.16398 PSVersion 3.0 CLRVersion 4.0.30319.296 PSRemotingProtocolVersion 2.2...

Cannot create a file when that file already exists. (Exception from HRESULT: 0x 800700B7)

02/11/2012 18:52
Cannot create a file when that file already exists. (Exception from HRESULT: 0x 800700B7) At C:\cham.TFS\_Tools\flnWebAppScripts\CreateWebApplication.ps1:62 char: 79 +     (get-childitem "IIS:\sites"|where-object {$_.Name -eq $iisSiteName}).Start <<<<...
Items: 251 - 260 of 384
<< 24 | 25 | 26 | 27 | 28 >>