I found this article which does a very good job explaining how to add built in web parts (like the content editor webpart). Unfortunately when I tried to add my own I couldn't get it to work. I have the webpart already installed on my sharepoint instance, I have checked the GAC and confirmed that the assembly for my webpart is there, but when I try to run this line:
$webpart = New-Object HighlightsTicker.HighlightsTickerPart.HighlightsTickerPart
I get the error:
New-Object : Cannot find type [HighlightsTicker.HighlightsTickerPart.HighlightsTickerPart]: make sure the assembly containing this type is loaded. At C:\Users\amiessler\AppData\Local\Temp\3\8c524086-dcea-4250-a4b9-0722c51e3d8f.ps1:5 char:22 + $webpart = New-Object <<<< HighlightsTicker.HighlightsTickerPart.HighlightsTickerPart + CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
This is what the code for my HightlightsTickerPart.cs looks like namespace/classname wise:
namespace HighlightsTicker.HighlightsTickerPart
{
[ToolboxItemAttribute(false)]
public class HighlightsTickerPart : WebPart
{
Do I need to do something differently to get this to work with a custom webpart?