Server.EnumObjectPermissions Server.EnumObjectPermissions Server.EnumObjectPermissions Method

Definition

Enumerates a list of permissions for objects on the instance of SQL Server.

Overloads

EnumObjectPermissions(String, ObjectPermissionSet) EnumObjectPermissions(String, ObjectPermissionSet) EnumObjectPermissions(String, ObjectPermissionSet)

Enumerates a list of object permissions for a specified grantee and a specified permission on the instance of SQL Server.

EnumObjectPermissions(String) EnumObjectPermissions(String) EnumObjectPermissions(String)

Enumerates a list of object permissions for a specified grantee on the application instance of SQL Server.

EnumObjectPermissions(ObjectPermissionSet) EnumObjectPermissions(ObjectPermissionSet) EnumObjectPermissions(ObjectPermissionSet)

Enumerates a list of object permissions for a specified permission on the instance of SQL Server.

EnumObjectPermissions() EnumObjectPermissions() EnumObjectPermissions()

Enumerates a list of object permissions for the instance of SQL Server.

EnumObjectPermissions(String, ObjectPermissionSet) EnumObjectPermissions(String, ObjectPermissionSet) EnumObjectPermissions(String, ObjectPermissionSet)

Enumerates a list of object permissions for a specified grantee and a specified permission on the instance of SQL Server.

public:
 cli::array <Microsoft::SqlServer::Management::Smo::ObjectPermissionInfo ^> ^ EnumObjectPermissions(System::String ^ granteeName, Microsoft::SqlServer::Management::Smo::ObjectPermissionSet ^ permissions);
public Microsoft.SqlServer.Management.Smo.ObjectPermissionInfo[] EnumObjectPermissions (string granteeName, Microsoft.SqlServer.Management.Smo.ObjectPermissionSet permissions);
Public Function EnumObjectPermissions (granteeName As String, permissions As ObjectPermissionSet) As ObjectPermissionInfo()
Parameters
granteeName
String String String

A String value that specifies the grantee.

permissions
ObjectPermissionSet ObjectPermissionSet ObjectPermissionSet

An ObjectPermissionSet object value that specifies the permission.

Returns

An array of ObjectPermissionInfo objects that contains object permission information for the specified grantee and permission on the instance of SQL Server.

Examples

C#

Server srv = new Server("(local)");  
ObjectPermissionSet objPermission = new ObjectPermissionSet();  
objPermission.Add(ObjectPermission.Connect);  
ObjectPermissionInfo[] oPI = srv.EnumObjectPermissions(grantee, objPermission);  
foreach (ObjectPermissionInfo op in oPI)  
{  
   Console.WriteLine(op.ToString());  
}  

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$objPermission = new-object Microsoft.SqlServer.Management.Smo.ObjectPermissionSet  
$objPermission.Add([Microsoft.SqlServer.Management.Smo.ObjectPermission]::Connect)  
$oPI = $srv.EnumObjectPermissions(grantee, $objPermission)  
foreach ($op in $oPI)  
{  
   Write-Host $op  

}

See Also

EnumObjectPermissions(String) EnumObjectPermissions(String) EnumObjectPermissions(String)

Enumerates a list of object permissions for a specified grantee on the application instance of SQL Server.

public:
 cli::array <Microsoft::SqlServer::Management::Smo::ObjectPermissionInfo ^> ^ EnumObjectPermissions(System::String ^ granteeName);
public Microsoft.SqlServer.Management.Smo.ObjectPermissionInfo[] EnumObjectPermissions (string granteeName);
Public Function EnumObjectPermissions (granteeName As String) As ObjectPermissionInfo()
Parameters
granteeName
String String String

A String value that specifies the grantee.

Returns

An array of ObjectPermissionInfo objects that contains object permission information for the specified grantee on the instance of SQL Server.

Examples

C#

Server srv = new Server("(local)");  
ObjectPermissionInfo[] oPI = srv.EnumObjectPermissions(grantee);  
foreach (ObjectPermissionInfo op in oPI)  
{  
   Console.WriteLine(op.ToString());  
}  

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$oPI = $srv.EnumObjectPermissions(grantee)  
foreach ($op in $oPI)  
{  
   Write-Host $op  
}  
See Also

EnumObjectPermissions(ObjectPermissionSet) EnumObjectPermissions(ObjectPermissionSet) EnumObjectPermissions(ObjectPermissionSet)

Enumerates a list of object permissions for a specified permission on the instance of SQL Server.

public:
 cli::array <Microsoft::SqlServer::Management::Smo::ObjectPermissionInfo ^> ^ EnumObjectPermissions(Microsoft::SqlServer::Management::Smo::ObjectPermissionSet ^ permissions);
public Microsoft.SqlServer.Management.Smo.ObjectPermissionInfo[] EnumObjectPermissions (Microsoft.SqlServer.Management.Smo.ObjectPermissionSet permissions);
Public Function EnumObjectPermissions (permissions As ObjectPermissionSet) As ObjectPermissionInfo()
Parameters
permissions
ObjectPermissionSet ObjectPermissionSet ObjectPermissionSet

An ObjectPermissionSet value that specifies the permission.

Returns

An array of ObjectPermissionInfo objects that contains object permission information for the specified permission on the instance of SQL Server.

Examples

C#

Server srv = new Server("(local)");  
ObjectPermissionSet objPermission = new ObjectPermissionSet();  
objPermission.Add(ObjectPermission.Connect);  
ObjectPermissionInfo[] oPI = srv.EnumObjectPermissions(objPermission);  
foreach (ObjectPermissionInfo op in oPI)  
{  
   Console.WriteLine(op.ToString());  
}  

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$objPermission = new-object Microsoft.SqlServer.Management.Smo.ObjectPermissionSet  
$objPermission.Add([Microsoft.SqlServer.Management.Smo.ObjectPermission]::Connect)  
$oPI = $srv.EnumObjectPermissions($objPermission)  
foreach ($op in $oPI)  
{  
   Write-Host $op  
}  

EnumObjectPermissions() EnumObjectPermissions() EnumObjectPermissions()

Enumerates a list of object permissions for the instance of SQL Server.

public:
 cli::array <Microsoft::SqlServer::Management::Smo::ObjectPermissionInfo ^> ^ EnumObjectPermissions();
public Microsoft.SqlServer.Management.Smo.ObjectPermissionInfo[] EnumObjectPermissions ();
Public Function EnumObjectPermissions () As ObjectPermissionInfo()
Returns

An array of ObjectPermissionInfo objects that contains object permission information for the instance of SQL Server.

Examples

C#

Server srv = new Server("(local)");  

ObjectPermissionInfo[] oPI = srv.EnumObjectPermissions();  
foreach (ObjectPermission op in oPI[])  
{  
   Console.WriteLine(op.ToString());  
}  

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  

$oPI = $srv.EnumObjectPermissions()  
foreach ($op in $oPI)  
{  
   Write-Host $op  
}  
See Also

Applies to