Table.EnumObjectPermissions Table.EnumObjectPermissions Table.EnumObjectPermissions Method

Definition

Enumerates a list of object permissions for the table.

Overloads

EnumObjectPermissions() EnumObjectPermissions() EnumObjectPermissions()

Enumerates a list of object permissions for the table.

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

Enumerates a list of object permissions for a specified permission on the table.

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

Enumerates a list of object permissions for a specified grantee on the table.

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 table.

EnumObjectPermissions() EnumObjectPermissions() EnumObjectPermissions()

Enumerates a list of object permissions for the table.

public:
 virtual 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 table.

Implements

Examples

The following code example demonstrates how to enumerate a list of object permissions for the table.

C#

Server srv = new Server("(local)");  
Database db = srv.Databases["AdventureWorks2012"];  

foreach (Table tb in db.Tables)  
{  
   tb.EnumObjectPermissions();  
}  

Powershell

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

foreach ($tb in $db.Tables)  
{  
   $tb.EnumObjectPermissions()  
}  
See Also

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

Enumerates a list of object permissions for a specified permission on the table.

public:
 virtual 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 table.

Implements

Examples

The following code example demonstrates how to enumerate a list of object permissions for a specific permission on the table.

C#

Server srv = new Server("(local)");  
Database db = srv.Databases["AdventureWorks2012"];  
ObjectPermissionSet objPermissionSet = new ObjectPermissionSet(ObjectPermission.Select);  
objPermissionSet.Select = true;  

foreach (Table tb in db.Tables)  
{  
   tb.EnumObjectPermissions(objPermissionSet);  
}  

Powershell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$db = New-Object Microsoft.SqlServer.Management.Smo.Database  
$objPermissionSet = new-object Microsoft.SqlServer.Management.Smo.ObjectPermissionSet([Microsoft.SqlServer.Management.Smo.ObjectPermission]::Select)  
$objPermissionSet.Select = $TRUE  

foreach ($tb in $db.Tables)  
{  
   $tb.EnumObjectPermissions($objPermissionSet)  
}  

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

Enumerates a list of object permissions for a specified grantee on the table.

public:
 virtual 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 table.

Implements

Examples

The following code example demonstrates how to enumerate a list of object permissions for a specific grantee.

C#

Server srv = new Server("(local)");  
Database db = srv.Databases["AdventureWorks2012"];  

foreach (Table tb in db.Tables)  
{  
   tb.EnumObjectPermissions("Guest");  
}  

Powershell

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

foreach ($tb in $db.Tables)  
{  
   $tb.EnumObjectPermissions("Guest");  
}  

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 table.

public:
 virtual 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 table.

Implements

Examples

The following code example demonstrates how to enumerate a list of object permissions for a specific grantee and a specific permission on the table.

C#

Server srv = new Server("(local)");  
Database db = srv.Databases["AdventureWorks2012"];  
ObjectPermissionSet objPermissionSet = new ObjectPermissionSet(ObjectPermission.Select);  
objPermissionSet.Select = true;  

foreach (Table tb in db.Tables)  
{  
   tb.EnumObjectPermissions("Guest", objPermissionSet);  
}  

Powershell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$db = New-Object Microsoft.SqlServer.Management.Smo.Database  
$objPermissionSet = new-object Microsoft.SqlServer.Management.Smo.ObjectPermissionSet([Microsoft.SqlServer.Management.Smo.ObjectPermission]::Select)  
$objPermissionSet.Select = $TRUE  

foreach ($tb in $db.Tables)  
{  
   $tb.EnumObjectPermissions("Guest", $objPermissionSet);  
}  

Applies to