locked
Load SharePoint .NET assemblies in Powershell RRS feed

  • Question

  • I can load System.Windows.Forms using below line :

    [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
    $openFile = New-Object System.Windows.Forms.OpenFileDialog

    But not able to load SharePoint assemblies using the similar line script:

    [reflection.assembly]::loadwithpartialname("Microsoft.SharePoint.Publishing") | Out-Null

    $obj = New-Object Microsoft.SharePoint.Publishing.Design

    getting below error: New-Object : Cannot find type [Microsoft.SharePoint.Publishing.Design]: verify that the assembly containing this type is loaded. Am I doing any mistake. Same with Add-Type.

    Tuesday, October 6, 2015 6:45 PM

All replies

  • Hi

    Which version of SharePoint are you using.Publishing feature is available in Standard and enterprise edition.

    Make sure you are not running with foundation version.


    Rajendra Singh
    sharepoint with my way
    Walking on water and developing software from a specification are easy if both are frozen
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

    Wednesday, October 7, 2015 9:05 AM
  • Hi Rajendra,

    I am running enterprise and can see Publishing dll file in my server's GAC. Only its not loading in powershell.

    Wednesday, October 7, 2015 12:26 PM
  • Hi

    Make sure you are running PowerShell with privileged user/Farm administrator.

      


    Rajendra Singh
    sharepoint with my way
    Walking on water and developing software from a specification are easy if both are frozen
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful


    Wednesday, October 7, 2015 1:02 PM
  • Hi Rajendra,

    I am running powershell with Administrator account.

    Wednesday, October 7, 2015 2:01 PM