Share via


BcsPowershellHelper.ShouldProcess Method

Requests confirmation from the user, in the context of a Cmdlet, before an operation is performed.

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

Syntax

'Declaration
Public Shared Function ShouldProcess ( _
    cmdlet As Cmdlet, _
    caption As String _
) As Boolean
'Usage
Dim cmdlet As Cmdlet
Dim caption As String
Dim returnValue As Boolean

returnValue = BcsPowershellHelper.ShouldProcess(cmdlet, _
    caption)
public static bool ShouldProcess(
    Cmdlet cmdlet,
    string caption
)

Parameters

  • cmdlet
    Type: Cmdlet

    A Cmdlet object.

Return Value

Type: System.Boolean
true if the record is to be processed; otherwise, false.

Exceptions

Exception Condition
ArgumentNullException

The cmdlet parameter is a null reference (Nothing in Visual Basic). The caption parameter is a null reference (Nothing in Visual Basic).

Remarks

The ShouldProcess(Cmdlet, String) method is an extension of the ShouldProcess() method in the Cmdlet class. Like the ShouldProcess() method, the user may or may not be prompted. For more information about confirmation requests, including information about how confirmation requests are affected by the $ConfirmPreference shell variable, see Requesting Confirmation.

The ShouldProcess(Cmdlet, String) method will display the contents of the caption parameter in the same style as the Microsoft Business Connectivity Services (BCS) and Single Sign On (SSO)Cmdlet objects.

The caption message can appear in either of the following contexts, and should be written to be appropriate in either:

  1. (caption)

    Continue with this operation?

    [Y] Yes [A] Yes to All...

  2. What if: (caption)

See Also

Reference

BcsPowershellHelper Class

BcsPowershellHelper Members

Microsoft.SharePoint.BusinessData.SharedService Namespace