Implementing a powershell script to list-workflow

Dec 25, 2012 at 11:24 AM
Edited Dec 25, 2012 at 2:24 PM

Hello everyone.

I'm kinda new to powershell and sharepoint designer and would appreciate some help.

After installing the Ilovesharepoint solution, I'm trying to automatically add a folder to another list located in another subsite by powershell script while creating a new list item.

I dont have any developer tools besides Powershell (in which the code has worked pefectly, and created the folder as requested).

this is the script I'm using:

 

if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) 
{
    Add-PSSnapin Microsoft.SharePoint.PowerShell
}
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy") | Out-Null
# Declaration of varaibles
$OpenWeb = $site.OpenWeb("/otherSubsite")
$OpenList = $OpenWeb.Lists["listInOtherSubsite"]
$folder = $var1
$rootFolder = $OpenList.RootFolder
$rootFolder.SubFolders.Add($folder)
$SPSite.Dispose()

 

The problem with this code it just wouldn't run and give out an error: "start action failed"