Tuesday, June 26, 2012

This Form Template Is Browser-Compatible, But It Cannot Be Browser-Enabled On The Selected Site.

I have an Infopath form which is published to a document library in a sharepoint site. I am using Infopath 2007 and MOSS 2007 enterprise edition.When I try to publish the form, and when I check the box "Enable the form to be filled out by using a browser", I only have the option to publish the form as Administrator approved form template, the other options of publishing it in a document library or publishing it as a content type are grayed out. 


 The infopath wizard is throwing an error messag:


"This form template is browser-compatible, but it cannot be browser-enabled on the selected site"


Troubleshooting Steps:


1. Check Central Administration Settings


-Central administration
-Application Management
-Click on Configure InfoPath Forms Services in the InfoPath Forms Services section (Check the following Check-boxes)
a. “Allow users to browser-enable form templates”
b.“Render form templates that are browser-enabled by users”


2. SharePoint Site Settings


-Open your SharePoint site
-click on Site Actions 
  -Site Settings
-Select Site collection features under Site Collection Administration
-Activate InfoPath Forms Services support or Office SharePoint Server Enterprise Site Collection feature


3. InfoPath 2007 client settings:


-Open the infopath client
-Tools
-Form Options
-select the Compatibility category
-check the 'Design a form template that can be opened in a browser or InfoPath'
-click Ok


4. Form Publishing:

-When you published the form on to a document library then please make sure this settings (imp step):
-check the “Enable this form to be filled out by using a browser” checkbox and finish.


5. Document Library Settings:


-Open the document library
-Settings
-Document Library Settings
-Advanced Settings
-select the “Display as a Web page” option in the Browser-enabled Documents category


After all these troubleshooting steps, if you still faces the same issue then please execute the below mentioned commands and your issue will be resolved:


stsadm -o deactivatefeature -filename IPFSSiteFeatures\feature.xml -force -url %SITE_COLLECTION_URL%


stsadm -o deactivatefeature -filename IPFSWebFeatures\feature.xml -force -url %SITE_COLLECTION_URL%


STSADM.EXE -o activatefeature -filename IPFSSiteFeatures\feature.xml -url %Sitecollection_URL% -force


STSADM.EXE -o activatefeature -filename IPFSWebFeatures\feature.xml -url %sitecollection_URL% -force

Monday, June 25, 2012

SharePoint Central Administration – Service Unavailable HTTP Error 503

Today when I after installing the active directory on my SharePoint box, I found that all of a sudden my Central Administration site stopped working. And keep on giving error message
Error: Service Unavailable HTTP Error 503. The service is unavailable.
In IIS console I noticed that App Pool for the central administration site was stopped. I restarted it, but again when I tried to open the site. App pool stopped again. And this happen again and agin. After spending some time. I realized that because I installed active directory, I need to refresh crendtails attached to App pool.
To change the identity acount attached to app pool, select app pool and right click on it. Select the ‘Advanced Settings’.


One thing to notice is that previously if you defined the user like servername\administrator, then it won’t work now. If you use this way it will give message that username doesn’t exist. Because now you have set up the Active Directory.

 Just use administrator and password and it will work or use domain/username and password.

Wednesday, June 20, 2012

Delete a Web application (SharePoint Foundation 2010)


This article describes how to delete a Web application. When you delete a Web application, you can optionally delete the content databases and the IIS Web sites. If you delete the content databases, all site content contained within them is deleted. If you delete the IIS Web sites, all IIS metabase entries that refer to the Web application are also deleted. If you only delete the Web application and not the content databases and the IIS Web sites, the content databases and IIS Web sites can be reused by another Web application.
Typically, you would delete a Web application for maintenance purposes or if you are rearchitecting the server farm.
If you are hosting content or applications other than SharePoint content on the IIS Web site that is hosting the Web application, you might want to consider not removing the IIS Web sites. Also, if you are performing maintenance work, you probably want to keep the IIS Web sites. However, if you are only hosting SharePoint content on the IIS Web site or if you plan to do a complete restructuring, then you would want to delete the IIS Web site.
If you want to delete the Web application temporarily, for example, to create the Web application under a different application pool, you might consider not removing the content databases. You can then recreate the Web application with the desired settings and reattach the existing content databases. If you delete the content databases, your content is gone forever unless you have a backup to restore the content databases.
Before you perform these procedures, confirm that:
  • You know the implications of deleting the IIS Web site and the content databases should you chose this option.
  • You have made a backup of the Web application that you plan to delete if, for some reason, you want to restore the deleted Web application. For more information, seeBack up a Web application (SharePoint Foundation 2010).
  • If you have User Account Control (UAC) turned on in Windows, and you use Windows PowerShell to delete a Web application, you must right-click the SharePoint 2010 Management Shell and select Run as administrator.
You can delete a Web application by using the SharePoint Central Administration Web site or Windows PowerShell. You typically use Central Administration to delete a Web application in a single server with built-in database deployment. If you want to automate the task of deleting a Web application, which is common in enterprises, use Windows PowerShell.

To delete a Web application by using Central Administration

  1. Verify that you have the following administrative credentials:
    • To delete a Web application, you must be a member of the Farm Administrators SharePoint group and a member of the local Administrator group on the computer running Central Administration.
  2. On the Central Administration Home page, in the Application Management section, click Manage web applications.
  3. Select the Web application that you want to delete, and on the ribbon, click Delete and then Delete Web Application.
  4. On the Delete Web Application page, in the Delete Options section, under Delete content databases select Yes if you want to delete the content databases associated with the Web application. Otherwise, select No to keep the content databases.
  5. Under Delete IIS Web sites, select Yes to delete the Web application and the associated IIS Web site. Otherwise, select No to remove only the association of the IIS Web site with the Web application.
Important Important:
If your IT environment requires the use of a database administrator (DBA) for database creation and management, you might need to contact your DBA to delete the content databases for the Web application. For information about deploying in an environment that uses DBA-created databases, see Deploy by using DBA-created databases (SharePoint Foundation 2010).

To delete a Web application by using Windows PowerShell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin. You must also be a member of the local Administrators group on the computer running Central Administration. If you want to delete the content databases associated with this Web application, you also need to have the SharePoint_Shell_Access role within these content databases.
  2. On the Start menu, click All Programs.
  3. Click Microsoft SharePoint 2010 Products.
  4. Click SharePoint 2010 Management Shell.
  5. At the Windows PowerShell command prompt, type the following command:
    Remove-SPWebApplication -identity http://sitename -Confirm

SharePoint 2010: Backup/Restore with PowerShell Command

If you want to backup/restore your site collection in SharePoint 2010, you can do with PowerShell command. I’ll spilt the post in two sections. One is on how to backup/restore in the same site collection and another is how to backup from one server/site collection to another. For the former (backup/restore in the same site collection), SharePoint provides nice easy GUI page in Central Administration page. However, for second one (backup/restore between different server) you need to run PowerShell scripts.

Backup/Restore in the same server and same site  collection

Sometimes you may want to backup from a site collection and your intention is to restore the backup in the same site collection. One example might be you have a site collection, say “http://myserver” and you are going to run code to test something against the site. However, you fear that running the code may break something and before you run the code, you want to backup the site so that in case running the code breaks something you can restore the backup taken before running the code. In the case, where you need to backup/restore is centered around same server and site collection, you can take SharePoint Central administration UI to do the backup/restore.
Backup Steps
1. Navigate to the Central Administration => Backup and Restore
2. Under “Farm Backup and Restore” section click “Perform a backup”.
3. Now you’ll be landed in the following page where you can select the site or site collection you want to take backup:
image
4. Click next and you’ll be navigated to the following page where you can select backup type (full or differential) and backup location:
image

Restoring Steps
To restore follow the steps:
1. Navigate to the Central Administration => Backup and Restore.
2. Under “Farm Backup and Restore” section click “Restore from a backup”. Follow the wizard to restore from a backup.

Backup/Restore from one server to another or from one Site Collection to another (with PowerShell command)

In some cases, you have developed a SharePoint site collection in your dev or stg machine and now you want to move the site with data from dev/stg to production. In such cases the process shown in the section “Backup/Restore in the same server and same site  collection” will not work. The recommended way is to use PowerShell command to take backup and restore the backup.
Backup a Site collection with PowerShell command
In SharePoint 2010, PowerShell command Backup-SPSite is used for taking backup. you can get details of the command from the msdn link. The following command will backup the site collection ‘http://myserver’.
Backup-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
Restore a Site Collection with PowerShell command
To restore site collection you’ll use the following command. Use –Force if you want to overwrite the existing site collection
Restore-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
However, once I had restored the backup I could not access the site. The problem was that I needed to deploy the custom SharePoint solution. So in case of site collection migration (with backup/restore) from one server to another or from one site collection to another, the steps should be:
  1. Restore the backup.
  2. If your source site collection (from where you taken backup) uses custom SharePoint solution, then deploy the solution in the destination site collection (where you are restoring the backup). If you try to access the site without deploying solution then you may get the site non-functional.
  3. Now you can try to access the site.
The important point here is that if you take backup from one server to another and restore it, the custom solution related to backup doesn’t go with backup. So after restoring backup you need to manually deploy the solution on the destination server. Then it’ll hopefully work.

Tuesday, June 19, 2012

PowerShell commands for SharePoint Solution deployment (.wsp)


Adding Solution: To add a solution to the form
Add-SPSolution -LiteralPath “.wsp location”
To know more about Add Solution, click here.
Example:
Add-SPSolution -LiteralPath “C:\Projects\testapp.wsp”


Installing Solution: To install a solution to the form
Install-SPSolution -Identity
“.wsp name” -WebApplication “http://webapplication”  -GACDeployment
To know more about Install Solution, click here.
Example:
Install-SPSolution -Identity  “testapp.wsp”  -WebApplication “http://testapp”-GACDeployment


Updating Solution: To update the solution in the form
Update-SPSolution –Identity “.wsp name” –LiteralPath “.wsp path” –GacDeployment
To know more about Update Solution, click here.
Example:
Update-SPSolution –Identity testapp.wsp” –LiteralPath C:\Projects\testapp.wsp” –GacDeployment


Uninstall Solution: To uninstall the solution from the form
Uninstall-SPSolution –Identity “.wsp name” –WebApplication http:// webapplication
To know more about Uninstall Solution, click here.
Example:
Uninstall-SPSolution –Identity “testapp.wsp” –WebApplication http:// testapp


Remove SolutionTo remove the solution from the form
Remove-SPSolution –Identity “.wsp name”
To know more about Remove solution, click here.
Example:
Remove-SPSolution –Identity “testapp.wsp”


Note: To get all SPSolution commands, use the below command:
Get-Command –noun *SPSolution*

SharePoint Powershell for Solution Deployment (WSP)


So we have covered a couple of areas with PowerShell but on of the most used, especially for those of use that like to play around with SharePoint, is the addition of solutions and features to our farms.
Now that we have PowerShell available in SharePoint 2010 you should really be using this to add your solutions, even though you can still do this with stsadm (but come on who wants to)

MOSS Solution Commands

In the 2007 days there were essentially 5 different commands used for dealing with solutions:
We added solutions using the addsolution command to the Farm:
1stsadm –o addsolution –filename "C:\Deployment\MySharePointSolutionPackage.wsp"
To deploy the solution we used the deploysolution command:
1stsadm –o deploysolution –name MySharePointSolutionPackage.wsp –urlhttp://webapplication –allowgacdeployment –immediate
To upgrade a solution we used the upgradesolution command:
1stsadm –o upgradesolution –name MySharePointSolutionPackage.wsp –filename "C:\Deployment\MySharePointSolutionPackage.wsp" –immediate
To retract and remove a solution we used the retractsolution and removesolution commands respectively:
1stsadm –o retractsolution –name MySharePointSolutionPackage.wsp –urlhttp://webapplication –immediate
2stsadm –o deletesolution –name MySharePointSolutionPackage.wsp

Powershell Solution Cmdlets

Adding

To add a solution to the Farm solution store use the Add-SPSolution cmdlet:
1Add-SPSolution –LiteralPath "C:\Deployment\MySharePointSolutionPackage.wsp"
To add a Sandboxed solution  use the Add-SPUserSolution cmdlet:
1Add-SPUserSolution –LiteralPath "C:\Deployment\MySharePointSolutionPackage.wsp" –Sitehttp://webapplication/sitecollection

Installing

To install ( commonly known as deploy)  a Farm Solution we use the Install-SPSolution cmdlet:
1Install-SPSolution –Identity MySharePointSolutionPackage.wsp –WebApplication http://webapplication –GACDeployment
To install ( commonly known as deploy)  a Sandboxed Solution we use the Install-SPUserSolutioncmdlet:
1Install-SPUserSolution –Identity MySharePointSolutionPackage.wsp –Sitehttp://webapplication/sitecollection

Updating

To update (know as upgrade in stsadm) a Farm solution use the Update-SPSolution cmdlet:
1Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “C:\Deployment\MySharePointSolutionPackage.wsp” –GacDeployment
To update (know as upgrade in stsadm) a Sandbox solution use the Update-SPUserSolution cmdlet:
1Update-SPUserSolution –Identity MySharePointSolution.wsp –Sitehttp://webapplication/site –ToSolution MySharePointSolutionPackage.wsp

Removing

To uninstall and remove FARM level solutions use the Uninstall-SPSolution and Remove-SPSolutioncmdlets:
1Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplicationhttp://webapplication
2Remove-SPSolution –Identity MySharePointSolution.wsp
To uninstall and remove Sandbox solutions use the Uninstall-SPSolution and Remove-SPSolutioncmdlets:
1Uninstall-SPUserSolution –Identity MySharePointSolution.wsp –Sitehttp://webapplication/sitecollection
2Remove-SPUserSolution –Identity MySharePointSolution.wsp –Sitehttp://webapplication/sitecollection
To get a list of all of the powershell cmdlets that deal with solutions use:
1Get-Command –noun *SPSolution*
To run all of the Administrative jobs that are queued:
1Start-SPAdminJob