Showing posts with label SharePoint 2007. Show all posts
Showing posts with label SharePoint 2007. Show all posts

Monday, March 28, 2011

Deploy and Retract .wsp Files using STSADM or PowerShell

As recommended in previous posts on using STSADM; I suggest creating a .cmd file to run the scripts, and save the scripts in a folder.  I am also assuming that you have STSADM added to your variable path.  Don't forget to right click, and run as Administrator!

Deploy with STSADM:
stsadm -o addsolution -filename path\solutionName.wsp
stsadm -o deploysolution -name solutionName.wsp -immediate -allowgacdeployment -force -allcontenturls
stsadm -o execadmsvcjobs
pause
iisreset /noforce

Retract with STSADM:
stsadm -o retractsolution -name solutionName.wsp -immediate -allcontenturls
stsadm -o execadmsvcjobs
pause
stsadm -o deletesolution -name solutionName.wsp -override
pause
iisreset /noforce

Remember, to run the following commands you must have SPShellAdmin permissions (see Add-SPShellAdmin)

Add, Install, Enable, Update, Disable, Uninstall, and Remove Farm or User Solutions (SPUserSolution) with PowerShell:
1) Update lines 1-4 (and line 6 if working with sandboxed solutions).
2) Remove the pound(#) symbol of the command you want to run.

$fileLocation = "C:\Projects\Event Receiver\bin\Debug"
$wspFileName = "Event_Receiver.wsp"
$featureIdentity = "Event Receiver_Feature1"
$url = "http://pc2010.local/"
# Sandboxed Solution Upgrade Name
$toSolutionName = "Event_Receiver_v2.wsp"

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0
$literalPath = $fileLocation + "\" + $wspFileName
Write-Host("Using WSP from: " + $literalPath)

<#
    *****************************
    *       Farm Solutions      *
    *****************************
#>

# Add WSP Solution (http://technet.microsoft.com/en-us/library/ff607552.aspx)
# Write-Host("Adding solution to Farm..."); Add-SPSolution -literalpath $literalPath

# Update Existing WSP Solution (http://technet.microsoft.com/en-us/library/ff607724.aspx)
# Write-Host("Updating solution in Farm..."); Update-SPSolution -identity $wspFileName -literalpath $literalPath -gacdeployment

# Deploy WSP solution to the Farm (http://technet.microsoft.com/en-us/library/ff607534.aspx)
# Write-Host("Deploying solution to the Farm..."); Install-SPSolution -identity $wspFileName -allwebapplications -gacdeployment -force

# Enable an installed feature at the given scope (http://technet.microsoft.com/en-us/library/ff607803.aspx)
# If the feature is a farm feature, no URL is needed
# Write-Host("Enabling Feature..."); Enable-SPFeature -identity $featureIdentity -url $url

# Disable a feature at the given scope (http://technet.microsoft.com/en-us/library/ff607879.aspx)
# If the feature is a farm feature, comment out -URL Parameter
# Write-Host("Disabling Feature..."); Disable-SPFeature -identity $featureIdentity -force -confirm:$false -url $url

# Retract WSP solution from the farm (http://technet.microsoft.com/en-us/library/ff607873.aspx)
# Write-Host("Retracting Solution from Farm..."); Uninstall-SPSolution -identity $wspFileName -confirm:$false

# Delete WSP solution from the farm (http://technet.microsoft.com/en-us/library/ff607748.aspx)
# Write-Host("Deleting solution from Farm..."); Remove-SPSolution -identity $wspFileName -force -confirm:$false

<#
    *****************************
    *       User Solutions      *
    *****************************
#>

# Add sandboxed solution to solution gallery (http://technet.microsoft.com/en-us/library/ff607715.aspx)
# Write-Host("Adding user solution to solution gallery..."); Add-SPUserSolution -LiteralPath $literalPath -Site $url

# Activate the sandboxed solution in a site collection (http://technet.microsoft.com/en-us/library/ff607653.aspx)
# Write-Host("Enabeling sandboxed solution..."); Install-SPUserSolution -identity $wspFileName -Site $url

# Upgrade EXISTING activated sandboxed solution (http://technet.microsoft.com/en-us/library/ff607902.aspx)
# Write-Host("Updating sandboxed solution..."); Update-SPUserSolution -identity $wspFileName -Site $url -ToSolution $toSolutionName

# Deactivate a sandboxed solution from site collection (http://technet.microsoft.com/en-us/library/ff607582.aspx)
# Write-Host("Retracting sandboxed solution..."); Uninstall-SPUserSolution -identity $wspFileName -Site $url -confirm:$false

# Delete a sandboxed solution from site collection (http://technet.microsoft.com/en-us/library/ff607709.aspx)
# Write-Host("Deleting sandboxed solution..."); Remove-SPUserSolution -identity $wspFileName -Site $url -confirm:$false
Update (11/2/2014)
Finally added the ability to Add, Enable, Update, Deactivate, and Remove Sandboxed Solutions (SPUserSolutions).
Added write-host output so that you know what you did...
Update (01/26/2015)
Added a closing parenthesis ")" for installing solution, and fixed some spelling errors

Thursday, March 24, 2011

RSS Feeds from Google News

Sometimes the news sources you are trying to collect do not have good RSS feeds.  Especially if you are trying to collect information about a very niche subject.  Google has made it very easy to collect news to display as an RSS feed within SharePoint.
1)  Go to http://news.google.com
2)  Type in your search parameters
3)  Modify the results URL by adding "&output=rss" at the end of the URL, and go to the new URL
4)  Verify that you are indeed getting the feed.

4)  Add the RSS Viewer webpart to your page
5)  Under RSS Properties, in the RSS Feed URL, add the modified URL.

Thursday, March 17, 2011

Increase Time Before Connection Timeout Between SQL and SharePoint

I have run into an issue with a couple of clients where a Connection Timeout Error occurs on either very large SSRS reports or in some custom web parts pulling data from SQL.   By default, the connection between SharePoint and your SQL servers will timeout after 120 seconds.  My current client just had me create a report that takes about 8.5 minutes to complete rendering...  oops, error!
This is how you fix the timeout issue:
1)  Go to the virtual directory for the site that is timing out.
         C:\inetpub\wwwroot\wss\VirtualDirectories\yourSite
2)  Make a backup of the web.config file.
3)  Edit the web.config file and add an httpRuntime property called "executionTimeout"

In the example below, my connection will now timeout after 5 minutes (300 seconds).

Thursday, October 28, 2010

Failed To Load SharePoint Designer Workflow

A client ask me to help troubleshoot one of their workflows.  The problem was an inconsistent issue; sometimes it worked, and sometimes it did not.  So I jumped on to my SPD 2007 to take a look at their workflow.  I could not see anything obvious in the workflow, logs and error reports.  It was getting late, so I called it a night.  The next morning I logged back into my SPD 2007 to see if I missed something on the workflow when I received the following error.

It worked last night, what has changed?  Well the client had recently set up a second web front end (WFE), and a network load balance (NLB) piece of hardware.  I had read through a couple of posts...
  1. http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/9874845b-9bf0-4723-9142-7384bbbcb1a6
  2. http://blog.qumsieh.ca/2010/01/16/failed-to-load-workflow-error-in-sharepoint-designer/
And while reading the second post, it hit me to check the web.config on the WFEs to make sure that they are identical. It turned out that I was missing an authorizedType Assembly in one of the web.config files.  After adding the line back in, all was happy again.