Some PS Script to install and uninstall Farm WSP

Following PowerShell Scripts are used often to install and deinstall SharePoint WSP Package (Farm Solution) without Visual Studio.

  • Add solution:

Add-SPSolution -LiteralPath “C:\temp\MySolution.wsp”

  • Install solution in GAC with the given WebApplication:

Install-SPSolution –Identity MySolution.wsp –WebApplication http://mywebapplication –GACDeployment

(If solution is only needed to be updated, the command “Update-SPSolution” should be executed, e.g.

Update-SPSolution –Identity Solution.wsp –LiteralPath “C:\temp\MySolution.wsp” –GacDeployment )

  • Uninstall and remove in the certain WebApplication:

Uninstall-SPSolution –Identity MySolution.wsp –WebApplication http://mywebapplication

Remove-SPSolution –Identity MySolution.wsp


Sometimes, Farm Feature should be enabled and disabled by PS.

Enable-SPFeature –Identity “MyFeatureName(or GUID)” –URL http://mywebapplication -Force

Disable-SPFeature –Identity “MyFeatureName(or GUID)” –URL http://mywebapplication

Parameters “-URL” and “-Force” are optional.

More details are included in TechNet site:



Show call stack of web part in SharePoint

Correlation Id  as follows is not the useful debug information for developer.


It is possible to use ULS Viewer to trace the log file in the background. (ULS View Download: )

In order to display the call stack of the web part, we should change the configuration in “web.config” file of the application directory ,e.g. “C:\inetpub\wwwroot\wss\VirtualDirectories\80”.

Set the attribute “CallStack” in Element “SafeMode” to “true”,

Set the attribute “mode” in Element “customErrors” to “Off”.

The better error message will be shown.


Thinking SharePoint just as Service

I totally agree with “Thinking SharePoint as Service”. Pesonal opinion, this is one of the best article to describe that the “gold time” of SharePoint is gone.

It doesn’t mean that SharePoint will not be used in the future but only just be considered as a service. For example, it may be integrated with MVC just because Workflow is required. “Injecting things in the host web or customizing master page is just like cat & mouse game”.

So for developer, it can not be to write some just running code. Just like Andrew Connell said in his blog, “I think that if you’ve hired me to do some work for you, you didn’t hire someone to bang away at a keyboard and give you some running bits in a few days / weeks / months. I think you hired me for my experience.”

Edit PDF File with Adobe Acrobat Reader DC using Out-Of-Box Behavior of SharePoint 2013

It is convenient to edit a PDF in SharePoint 2013. The following steps are not to edit PDF file in the browser directly by configuring Office Web Apps. It is the Out-of-Box behavior in SharePoint 2013 and will be configured with following steps.

  • Add items in “\Web Server Extensions\15\Template\XML\DOCICON.xml”:

<Mapping Key=”pdf” Value=”icpdf.gif” OpenControl=”AdobeAcrobat.OpenDocuments”/>

  • In CA, set “Browser File Handling” to “Permissive”konfiguration.
  • Execute the following PowerShell code:
    $webApplication = Get-SPWebApplication “http://webapplication/

Now, the “Edit Document” in SharePoint 2013  is enabled and PDF file can be edited as follows:


Open and Checkout with  Adobe Acrobat Reader DC:


After editing, Checkin and add comment, just like editing a word document with desktop application.



There are more details to control PDF file behavior in SharePoint in the article of the following link:

Add default action “Sign in as a different user”

There is no default action to sign in as a different user in SharePoint 2013. So a module must be added as follows:

Title=”Sign in as a different User”>
<UrlAction Url=”/_layouts/closeConnection.aspx?loginasanotheruser=true”/>

The button appears again.


More about default Custom Action ID:

Fremde JavaScript Datei in “CommandUIHandler” von Ribbon hinzufügen

Wenn JavaScript direkt in “CommandAction” hinzugefügt wird, ist es schwer zu debuggen.  Solche JS Code können in eine Datei zusammengefasst werden, dann wird nur in “CommandAction” als Methode aufgerufen werden.


<CommandUIHandler Command=”Test.Command1″

<CustomAction Id=”TestAction”

Ein kleiner Unterschied zwischen SharePoint 2010 und SharePoint 2013 ist der Pfad von “ScriptSrc”. In SharePoint 2010 muss folgendes sein.