共用方式為


SPCmdlet Class

Represents an abstract base class for all custom cmdlets that are written to be used in SharePoint deployments, providing uniform behavior across all SharePoint cmdlets.

Inheritance Hierarchy

System.Object
  InternalCommand
    Cmdlet
      PSCmdlet
        Microsoft.SharePoint.PowerShell.SPCmdlet
          SPCmdletUpdateSPInfoPathUserFileUrl
          Microsoft.SharePoint.PowerShell.SPGetCmdletBase<TCmdletObject>
          Microsoft.SharePoint.PowerShell.SPNewCmdletBase<TCmdletObject>
          Microsoft.SharePoint.PowerShell.SPRemoveCmdletBase<TCmdletObject>
          Microsoft.SharePoint.PowerShell.SPSetCmdletBase<TCmdletObject>

Namespace:  Microsoft.SharePoint.PowerShell
Assembly:  Microsoft.SharePoint.PowerShell (in Microsoft.SharePoint.PowerShell.dll)

Syntax

'Declaration
<SPCmdletAttribute> _
Public MustInherit Class SPCmdlet _
    Inherits PSCmdlet
'Usage
Dim instance As SPCmdlet
[SPCmdletAttribute]
public abstract class SPCmdlet : PSCmdlet

Remarks

Use this base class when writing cmdlets for use with SharePoint deployments. This class inherits from System.Management.Automation.PSCmdlet, so it provides all of the functionality of the Windows PowerShell framework, while adding a set of SharePoint-specific functions that are most commonly used across the SharePoint platform.

The core workload of every cmdlet that inherits from the SPCmdlet base class is completed by overriding the virtual method, InternalProcessRecord(). This method is called from the ProcessRecord() method.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPCmdlet Members

Microsoft.SharePoint.PowerShell Namespace

PSCmdlet