Share via


Session.AddTarget Method (String)

Adds a new Target object to the session.

Namespace:  Microsoft.SqlServer.Management.XEvent
Assembly:  Microsoft.SqlServer.Management.XEvent (in Microsoft.SqlServer.Management.XEvent.dll)

Syntax

'Declaration
Public Function AddTarget ( _
    targetName As String _
) As Target
'Usage
Dim instance As Session 
Dim targetName As String 
Dim returnValue As Target 

returnValue = instance.AddTarget(targetName)
public Target AddTarget(
    string targetName
)
public:
Target^ AddTarget(
    String^ targetName
)
member AddTarget : 
        targetName:string -> Target
public function AddTarget(
    targetName : String
) : Target

Parameters

  • targetName
    Type: System.String
    A string value that contains the fully qualified name of the target.

Return Value

Type: Microsoft.SqlServer.Management.XEvent.Target
The newly created Target object.

Exceptions

Exception Condition
ArgumentNullException

Parameter targetName is null

XEventException

Target name is malformed or wrong.

See Also

Reference

Session Class

AddTarget Overload

Microsoft.SqlServer.Management.XEvent Namespace