Wednesday, July 21, 2010

How to deploy a SharePoint 2010 solution developed by visual studio 2010 to another server using Powershell commands

Normally we can deploy the visual studio solution using the IDE. but then we need to SharePoint run on the same local machine which is used to the development. using   powershell as well as stsadm commands  you can deploy it to another server.

  • copy the content of the bin folder. ( Normally 3 files with .wsp solution file). if the files are not available you can click build and package menus in the IDE to create those files. (of cause you also can get the release folder content if you change the IDE mode to the release)
  • then copy the content to the server which you want to deploy. (for the moment assume you copied it to C:\solution folder , and assume you have a wsp file named abcsolution.wsp)
  • open the powershell window. if the current user have no permission you may need to run is s administrator.

               image

  • Then you need to add the solution to the solution store. for that
    • Add-SPSolution -LiteralPath C:\Solution\abcsolution.wsp

image

  • then you need to install it to the web application.
    • Install-SPSolution –Identity abcsolution.wsp  -WebApplication http://server
  • some times it asks for GAC permission then you need to specify –GACDeployment
    • Install-SPSolution –Identity abcsolution.wsp  -WebApplication http://server -GACDEployment

      image

This operation can be performed only on a computer that is joined to a server farm by users who have permissions ..

This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.

Cause 
I came across with error when i going to restore the SharePoint site to another farm. in here i ran the application as “run as administrator”.  the problem is we want to have permission to SharePoint database. so you can put your username to SharePoint SQL server database and give the sys admin permission.
or else you can use already configured user. 

Cause
Same error occurred to me in another time. But this time i found All server in my farm do  not connected to domain properly. You can figure that out by pinging.

Tuesday, July 13, 2010

How to Backup and Restore SharePoint 2010 site collection

There are two options available (May be many) .

  • Using PowerShell
  • Using stsadm

In 2010 PowerShell is recommended. But in my case PowerShell commands not worked. I mean the midlets commands are missing in the pc. Therefore I used second option.

Option1

  • Backup
    • Go to the PowerShell (you should have execution permission and at least read permission to the SharePoint database)
      image 

    Apart from that you can provide many other parameters to the command.

    Backup-SPSite [-Identity] <SPSitePipeBind> -Path <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-NoSiteLock <SwitchParameter>] [-UseSqlSnapshot <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

    Refer

  • Restore
    • Go to the PowerShell and type following command. This command will create a site collection and restore the site. Other wise you can use force command to override the content  image

Option2

You can also use stsadm commands to backup and restore.

  • Backup
    • Open the command prompt
    • Goto C:\program files\common files\Microsoft shared\web server extensions\ 12 \ bin
    • Stsadm –o backup –url http://server/sites/name -filename C:\site.bak
  • Restore
    • Stsadm –o restore –url http://server/sites/name -filename C:\site.bak
    • You can use –override to replace the existing site.

Wednesday, July 7, 2010

Datasheet view is read only in the SharePoint list

If the content approval is enabled to the list disable it. then it will remove the read only  mode.

A Datasheet component compatible with Microsoft SharePoint Foundation is Not installed

sperror

when I opened the datasheet view i engage with this error. I am using SharePoint 2010 with office 2010. This error is because office2010 still do not have the datasheet edit component in 64 bit. these i open the SharePoint site with a machine installed office 2003 and it worked perfectly.

there is a office2007 driver that you can also installed with office2010 to  overcome this issue.