Search This Blog

Friday, June 26, 2015

SharePoint Feature Installation, Activation, Deactivation, and Uninstallation using PowerShell

To install a SharePoint feature with PowerShell
Install-SPFeature FeatureFolderName

To activate a feature
Enable-SPFeature FeatureFolderName -Url http://server/site/subsite

To deactivate a feature
Disable-SPFeature FeatureFolderName -Url http://server/site/subsite

To uninstall a feature
Uninstall-SPFeature FeatureFolderName

Examples:

Activate site collection feature
$site = Get-SPSite http://sp2010
Enable-SPFeature -Identity �FeatureName� -Url $site.Url
$site.Dispose()

Activate site feature
$web = Get-SPWeb http://sp2010
Enable-SPFeature -Identity �FeatureName� -Url $web.Url
$web.Dispose()

Activate site collection features for all site collections in a Web Application
$webApp = Get-SPWebApplication -Identity http://sp2010
$webApp | Get-SPSite -limit all | ForEach-Object {Enable-SPFeature -Identity �FeatureName� -Url $_.Url}

How to Deactivate a SharePoint feature using PowerShell or STSADM

To Disable a SharePoint Feature, you must first determine the scope of the feature. If the scope is Web-based or is a site collection scope, the URL parameter is required. However, if the scope is farm-based, the URL parameter is not required.

Syntax - PowerShell

Disable-SPFeature [-Identity] <SPFeatureDefinitionPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-Url <String>] [-WhatIf [<SwitchParameter>]]

This example disables the "MyCustom" Web site scoped feature at http://somesite.
Disable-SPFeature -identity "MyCustom" -URL http://somesite

This example disables all features in the subsite at http://somesite/myweb.
$w = Get-SPWeb http://somesite/myweb | ForEach{ $_.URL }
Get-SPFeature -Web $w |%{ Disable-SPFeature -Identity $_ -URL $w}

Syntax - STSADM

stsadm -o deactivatefeature
   -filename
   -name <feature folder>
   -id <feature ID>
   [-url] <URL name>
   [-force]

Parameter
Value
Description
filename
A valid file path, such as "MyFeature\Feature.xml"
Path to feature must be a relative path to the 14\Template\Features directory. Can be any standard character that the Windows system supports for a file name.
name
Name of the feature directory, such as �MyFeature�
Name of the feature folder located in the 14\Template\Features directory
id
A valid GUID, e.g.  �11d186e-7306-4902-a825-0eb7609e9280�
GUID that identifies the feature to activate
url
A valid URL, such as http://server_name
URL of the Web application, site collection, or Web site to which the feature is being activated


How to Activate a SharePoint feature using PowerShell or STSADM

To Enable a SharePoint Feature, you must first determine the scope of the feature. If the scope is Web-based or is a site collection scope, the URL parameter is required. However, if the scope is farm-based, the URL parameter is not required.

Syntax - PowerShell

Enable-SPFeature [-Identity] <SPFeatureDefinitionPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-CompatibilityLevel <Int32>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-PassThru <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

This example enables the "MyCustom" site scoped SharePoint Feature at http://somesite.
Enable-SPFeature -identity "MyCustom" -URL http:// sitename

This example enables all SharePoint Features in the subsite at http://somesite/myweb.
$w = Get-SPWeb http://somesite/myweb | ForEach{ $_.URL }
Get-SPFeature -Web $w |%{ Enable-SPFeature -Identity $_ -URL $w}

Syntax - STSADM

stsadm -o activatefeature
   {-filename <relative path to Feature.xml> | -name <feature folder> | -id <feature ID>}
   [-url] <URL name>
   [-force]

Parameter
Value
Description
filename
A valid file path, such as "MyFeature\Feature.xml"
Path to feature must be a relative path to the 14\Template\Features directory. Can be any standard character that the Windows system supports for a file name.
name
Name of the feature directory, such as �MyFeature�
Name of the feature folder located in the 14\Template\Features directory
id
A valid GUID, e.g.  �11d186e-7306-4902-a825-0eb7609e9280�
GUID that identifies the feature to activate
url
A valid URL, such as http://server_name
URL of the Web application, site collection, or Web site to which the feature is being activated

Note : If you try to use the Url parameter on a farm-scoped feature, you receive the following error message:
The feature �<feature name>� applies to the entire farm; the Url parameter cannot be used with farm-scoped features.

Thursday, June 18, 2015

How to Remove a SharePoint subsite through PowerShell

The Remove-SPWebcmdlet completely deletes the Web specified by the Identity parameter.
Note:Deleting the top level Web site of a site collection causes the entire site collection to be removed.

Syntax

Remove-SPWeb [-Identity] <SPWebPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Recycle <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

Example

Remove-SPWeb http://sitename/subsite

This example completely deletes a subsite.

Import sites, lists, or document libraries in SharePoint

We can import a site, list, or document library in SharePoint by PowerShell.
Start the SharePoint Management Shell.

Syntax

Import-SPWeb [-Identity] <SPWebPipeBind> -Path <String> [-ActivateSolutions <SwitchParameter>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-HaltOnError <SwitchParameter>] [-HaltOnWarning <SwitchParameter>] [-IncludeUserCustomAction <None | All>] [-IncludeUserSecurity <SwitchParameter>] [-NoFileCompression <SwitchParameter>] [-NoLogFile <SwitchParameter>] [-UpdateVersions <Append | Overwrite | Ignore>] [-WhatIf [<SwitchParameter>]]

Example
Import-SPWeb http://site -Path export.cmp -UpdateVersions Overwrite
This example imports the contents of export.cmp into a site at http://site, overwriting the versioned content on the site with the contents of the export.cmp file.

Export sites, lists, or document libraries in SharePoint

We can export a site, list, or document library in SharePoint by using the SharePoint Central Administration website or Windows PowerShell.

Use Windows PowerShell to export a site, list, or document library in SharePoint
To export a site, list or document library by using Windows PowerShell you need to have the below permissions :
securityadminfixed server role on the SQL Server instance.
db_ownerfixed database role on all databases that are to be updated.

1) Start the SharePoint Management Shell.

Syntax

Export-SPWeb -Identity <SiteURL> -Path <Path and File Name> [-ItemUrl <URL of Site, List, or Library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose]

Use Central Administration to export a site, list, or document library in SharePoint

Only export one site, list, or document library at a time.
To export a site, list, or document library by using Central Administration, verify that the user account that is performing this procedure is a member of the Farm Administrators group.

1) Start SharePoint Central Administration.

2) In Central Administration, on the home page, click Backup and Restore.

3) On the Backup and Restore page, in the Granular Backup section, click Export a site or list.

4) On the Site or List Export page, in the Site Collection section, select the site collection from the Site Collection list, and then select the site from the Site list.

5) If you are exporting a site, skip this step, Select the list or document library from the List list.

6) In the File Location section, in the Filename box, type the UNC path of the shared folder and the file to which you want to export the list or document library. The file name must use the .cmp extension.

7) If the file already exists and you want to use this file, select the Overwrite existing files check box. Otherwise, specify a different file name.

8) If you want to export all the security and permissions settings with the list or library, in the Export Full Security section, select the Export full security check box.

9) If you want to specify which version of the list or library to export, select one of the following versions from the Export versions list: All Versions , Last Major , Current Version , Last Major and Last Minor


10) When you have specified the settings that you want, click Start Export.

SharePoint Major Version and Minor Version

A major version is usually one that represents a milestone, such as completion of an outline or a chapter. Major versions are numbered with whole numbers, such as 3.0, 4.0, and so on.

A minor version represents interim check-ins while a particular file is under development. Minor versions are numbered with decimals, such as 4.1, 4.2, 4.3, and so on.

In many organizations, versioning is set up so that only the owner of the file and people who can approve items can see minor versions. In others, it is set up so that anyone who can edit files in the library, or anyone who has Read permission to the library, can see all versions.

Note: Major and minor versions are available in libraries, but not in lists.
Limiting the number of versions is generally a good practice. It means you can conserve space on the server and reduce clutter for users. But, if your organization is required to save all versions for legal or other reasons, do not apply any limits.
  • When you check out a file in a versioning-enabled library, a new version is created every time you check it back in. And, if major and minor versions are part of the configuration of your library, you can designate, at check-in, which type of version you are checking in. In libraries where check-out is required, versions are only created upon check-in.


  • In libraries where check-out is not required, a new version is created the first time you save after opening the file. Each subsequent save overwrites the version that you created with the first save. If you close the application and then reopen the document, the first save will, once again, produce a version. This can cause the number of versions to proliferate very rapidly.

How to View a file or item from previous version

If you need to view an older version of an item or file, you can select the older version and �view� it so that it becomes the current version.

1. Navigate to the list or library where your item or file is located.
2. Hover over the item or file for which you want to manage versions until you see a drop-down arrow.
3. Click the drop-down arrow and select Version History.
4. Hover over the version that you want to view and select the document.
5. This will display the document with that particular version.

How to Delete a previous version

If you need to make sure that no one can read a version that has inaccurate or otherwise troublesome information, you can delete it.

1. Navigate to the list or library where your item or file is located.
2. Hover over the item or file for which you want to manage versions until you see a drop-down arrow.
3. Click the drop-down arrow and select Version History.
4. Hover over the version that you want to delete until you see a drop-down arrow.
5. Click the drop-down arrow and select Delete.
6. When you are prompted to confirm the deletion, click OK.


Note: When you delete a version, it is sent to the Recycle Bin, where you, or another person who has the necessary permissions, can recover it. If you do not see the Recycle Bin on your site, your server administrator might have disabled it.

How to Restore a file or item from previous version

If you need an older version of an item or file, you can select the older version and �restore� it so that it becomes the current version.

1. Navigate to the list or library where your item or file is located.
2. Hover over the item or file for which you want to manage versions until you see a drop-down arrow.
3. Click the drop-down arrow and select Version History.
4. Hover over the version that you want to restore until you see a drop-down arrow.
5. Click the drop-down arrow and select Restore.
6. When you are prompted to confirm the restoration as your current version, click OK.

SharePoint Versioning

Versioning is available for list items in all default list types�including calendars, issue tracking lists, and custom lists. It is also available for all file types that can be stored in libraries, including Web Part pages.
Versioning helps us with the following:

Track history of a version -When versioning is enabled, you can see when an item or file was changed and who changed it. You can also see when properties (information about the file) were changed. For example, if someone changes the due date of a list item, that information appears in the version history. You can also see the comments people make when they check files into libraries.

Restore a previous version - If you made a mistake in a current version, if the current version is corrupt, or if you simply like a previous version better, you can replace the current version with a previous one. The �restored� version becomes the new current version.

View a previous version - You can view a previous version without overwriting your current version. If you are viewing version history within a Microsoft Office document, such as a Word or Excel file, you can compare the two versions to determine what the differences are.

To do this�
I need this permission�
View version history
Full Control, Contribute, Read
Restore a previous version
Full Control, Contribute
Delete a version
Full Control, Contribute
Unpublish a version
Full Control, Contribute
Recover deleted a deleted version (30 days)
Full control and/or Contribute

Wednesday, June 17, 2015

There has been a critical error while processing the form.

Issue Description

You get the below error message when you use InfoPath Forms on SharePoint 2010 and Internet Explorer 11.

Critical Error
There has been a critical error while processing the form.  
Click Start Over to load a new copy of the form. If this error persists, contact the support team for the Web site.
Click Close to exit this message.
Object doesn't support property or method 'addEventListener'



Fix

There is an incompatibility with some SharePoint 2010 features and Internet Explorer 11.
To fix this, IE needs to run on Enterprise Mode.

Open Internet Explorer -> Right Click Enable Menu bar -> Tools - > Select Enterprise Mode


Monday, June 15, 2015

BDC The name �Domain\User Name� could not be resolved via Active Directory

Issue

When you work with SharePoint 2010 and BDC Service application when you try to create an External Content Type, you might come across this error. This is because the person who had created the Content type is not present in the Active Directory. He/she may have left your organization.



Resolution

1) Browse to Central Administration

2) Choose the BDC Service application. Make sure that this person is not listed as the administrator on the service application

3) Inside the BDC service application, select Set Metadata Store Permissions


4) The user listed in the error will be listed here.

5) Select the user and remove him/her.

6) Make sure that you select the checkbox that says - 
Propagate permissions to all BDC Models, External Systems and External Content Types in the BDC Metadata Store. Doing so will overwrite existing permissions.


7) Click OK

Thursday, June 11, 2015

SharePoint Group - Site Owner (Full Control)

When a SharePoint site is created, by default 3 SharePoint groups are created

Site Owners - Full control
Site Members - Contribute
Site Visitors - Read

Below are the permissions you get when you are a Site Owner (Full Control)

List Permissions

Manage Lists - Create and delete lists, add or remove columns in a list, and add or remove public views of a list.
Override Check Out - Discard or check in a document which is checked out to another user.
Add Items - Add items to lists and add documents to document libraries.
Edit Items - Edit items in lists, edit documents in document libraries, and customize Web Part Pages in document libraries.
Delete Items - Delete items from a list and documents from a document library.
View Items - View items in lists and documents in document libraries.
Approve Items - Approve a minor version of a list item or document.
Open Items - View the source of documents with server-side file handlers.
View Versions - View past versions of a list item or document.
Delete Versions - Delete past versions of a list item or document.
Create Alerts - Create alerts.
View Application Pages - View forms, views, and application pages. Enumerate lists.

Site Permissions

Manage Permissions - Create and change permission levels on the Web site and assign permissions to users and groups.
View Web Analytics Data - View reports on Web site usage.
Create Subsites - Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.
Manage Web Site - Grants the ability to perform all administration tasks for the Web site as well as manage content.
Add and Customize Pages - Add, change, or delete HTML pages or Web Part Pages, and edit the Web site using a Microsoft SharePoint Foundation-compatible editor.
Apply Themes and Borders - Apply a theme or borders to the entire Web site.
Apply Style Sheets - Apply a style sheet (.CSS file) to the Web site.
Create Groups - Create a group of users that can be used anywhere within the site collection.
Browse Directories - Enumerate files and folders in a Web site using SharePoint Designer and Web DAV interfaces.
View Pages - View pages in a Web site.
Enumerate Permissions - Enumerate permissions on the Web site, list, folder, document, or list item.
Browse User Information - View information about users of the Web site.
Manage Alerts - Manage alerts for all users of the Web site.
Use Remote Interfaces - Use SOAP, Web DAV, the Client Object Model or SharePoint Designer interfaces to access the Web site.
Use Client Integration Features - Use features which launch client applications. Without this permission, users will have to work on documents locally and upload their changes.
Open - Allows users to open a Web site, list, or folder in order to access items inside that container.
Edit Personal User Information - Allows a user to change his or her own user information, such as adding a picture.

Personal Permissions

Manage Personal Views - Create, change, and delete personal views of lists.
Add/Remove Personal Web Parts - Add or remove personal Web Parts on a Web Part Page.
Update Personal Web Parts - Update Web Parts to display personalized information.

SharePoint Group - Site Member (Contribute)

When a SharePoint site is created, by default 3 SharePoint groups are created

Site Owners - Full control
Site Members - Contribute
Site Visitors - Read

Below are the permissions you get when you are a Site Member (Contribute)

List Permissions

Add Items - Add items to lists and add documents to document libraries.
Edit Items - Edit items in lists, edit documents in document libraries, and customize Web Part Pages in document libraries.
Delete Items - Delete items from a list and documents from a document library.
View Items - View items in lists and documents in document libraries.
Open Items - View the source of documents with server-side file handlers.
View Versions - View past versions of a list item or document.
Delete Versions - Delete past versions of a list item or document.
Create Alerts - Create alerts.
View Application Pages - View forms, views, and application pages. Enumerate lists.

Site Permissions

Browse Directories - Enumerate files and folders in a Web site using SharePoint Designer and Web DAV interfaces.
View Pages - View pages in a Web site.
Browse User Information - View information about users of the Web site.
Use Remote Interfaces - Use SOAP, Web DAV, the Client Object Model or SharePoint Designer interfaces to access the Web site.
Use Client Integration Features - Use features which launch client applications. Without this permission, users will have to work on documents locally and upload their changes.
Open - Allows users to open a Web site, list, or folder in order to access items inside that container.
Edit Personal User Information - Allows a user to change his or her own user information, such as adding a picture.

Personal Permissions

Manage Personal Views - Create, change, and delete personal views of lists.
Add/Remove Personal Web Parts - Add or remove personal Web Parts on a Web Part Page.
Update Personal Web Parts - Update Web Parts to display personalized information.


Propellerads