Thursday, June 18, 2015

How to Remove a SharePoint subsite through PowerShell

The Remove-SPWeb cmdlet 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 :
securityadmin fixed server role on the SQL Server instance.
db_owner fixed 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