Server::EnumObjectPermissions Method (String)
SQL Server 2012
Enumerates a list of object permissions for a specified grantee on the application instance of SQL Server.
Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
Parameters
- granteeName
- Type: System::String
A String value that specifies the grantee.
Return Value
Type: array<Microsoft.SqlServer.Management.Smo::ObjectPermissionInfo>An array of ObjectPermissionInfo objects that contains object permission information for the specified grantee on the instance of SQL Server.
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
}
