Skip to main content

Posts

Showing posts with the label powershell

Add Rating to sharepoint list on site collecion using power shell

ShellScript: [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")   $site = New-Object Microsoft.SharePoint.SPSite("http://sitecollection URL")   $web=$site.OpenWeb()   if ($web -ne $Null)   {         $AverageRating=$web.Fields[[System.Guid]"5a14d1ab-1513-48c7-97b3-657a5ba6c742"]         $RatingCount=$web.Fields[[System.Guid]"b1996002-9167-45e5-a4df-b2c41c6723c7"]         $PagesList=$web.lists["Pages"]         if ($PagesList -ne $Null)         {               Write-Host " Processing List : " $PagesList.Title               $ct=$PagesList.ContentTypes["Page"]           ...

Create Search Scope and apply ruele using power shell also define Search Setting to Site Collection

[string]$searchSiteName = "Search" # Creates the search scope on site so it shows on the dropdown function CreateSearchScope([string] $siteURL){     # Variables for Site     [string]$searchServiceApplicationName = "Search Service Application"     [string]$adminServiceName = "SPAdmeinV4"     [string]$lmsContentTypeTemplateID = "STS_ListItem_10001"     [string]$searchDropDownValue= "Search Dropdown"     [string]$scopeName = "LMS Search"     # Gets the Search Service Application Object     Write-Host "Get-SPEnterPriseSearchServiceApplication" -foregroundcolor green     $ssa = Get-SPEnterPriseSearchServiceApplication -Identity $searchServiceApplicationName     # Get the root web     Write-Host "Get the root web." -foregroundcolor green     $site = New-Object Microsoft.SharePoint.SPSite($siteURL)    ...

Apply C# code in Power Shell Script

  Apply C# code in Power Shell # ----------- Csharp code for variations -------------- $Assem = (     "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"    ,     "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"             )     $Source = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; using Microsoft.SharePoint.Publishing; using Microsoft.SharePoint.Administration; using Syste...