Created
December 22, 2016 09:38
-
-
Save IAMPetro/417c62b187281122e00aa7e20957b5d0 to your computer and use it in GitHub Desktop.
SharePoint: Mysterious parameter name g
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-SPUserSolutionProperties | |
{ | |
<# | |
.Synopsis | |
This function will allow you to add additional properties to a Sandboxed solution | |
.Description | |
This function will add the additional Sandboxed solution information specified under the " #Sandboxed Solution Properties " comment tag | |
.Example | |
C:\> Add-SPUserSolutionProperties –SiteUrl “http://yourdomain.com/sites/Finance –SolutionName My.Sandboxed.Solution -SolutionId 6b701ca1-9c46-452f-8f91-73799ffb24fa -SolutionHash 8JfkvlDR9eTUcdZb1GDncs+hhqy8wZPd0oEh2GIK/20= | |
.Notes | |
Name: Add-SPUserSolutionProperties | |
Author: Petro Margaritis | |
Last Edit: 04/07/2012 | |
Keywords: Sandboxed Solution, Troubleshooting, Properties | |
.Link | |
https://www.iampetro.com/ | |
#> | |
Param ( | |
[parameter(Mandatory=$true)][string]$SiteUrl, | |
[parameter(Mandatory=$true)][string]$SolutionName, | |
[parameter(Mandatory=$true)][string]$SolutionId, | |
[parameter(Mandatory=$true)][string]$SolutionHash, | |
[parameter(Mandatory=$false)][int]$SolutionHasAssemblies, | |
[parameter(Mandatory=$false)][string]$vti_cachedcustomprops | |
) | |
$web = Get-SPWeb $SiteUrl | |
# Access the Solution Gallery of the Site Collection | |
$solGallery = $web.Lists["Solution Gallery"] | |
# You will first need to identify the solutions ID number in the gallery | |
$solID = ($solGallery.Items | Where-Object {$_.displayName -eq $SolutionName}).ID | |
# Access the Solution in question | |
if ($solID -ne $null) | |
{ | |
$solution = $solGallery.GetItemById($solID) | |
# Sandboxed Solution Properties | |
$solution.Properties["SolutionId"] = $SolutionId | |
$solution.Properties["SolutionHash"] = $SolutionHash | |
if ($SolutionHasAssemblies -ne $null) | |
{ | |
$solution.Properties["SolutionHasAssemblies"] = $SolutionHasAssemblies | |
} | |
if ($vti_cachedcustomprops -ne $null) | |
{ | |
$solution.Properties["vti_cachedcustomprops"] = $vti_cachedcustomprops | |
} | |
# Apply the changes | |
$solution.Update() | |
Write-Host "The Sandboxed Solution has been updated successfully" -foregroundcolor Green | |
} | |
else | |
{ | |
Write-Host "The Sandboxed Solution could not be found, please ensure you have entered the correct Solution name and that it has been uploaded to the Solution Gallery in the" $web.Title "Site Collection" -foregroundcolor Yellow | |
} | |
# Dispose of the SPWeb object | |
$web.Dispose() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment