I'm attempting to generate Roles through API code and am looking to set a series of Permissions for the Role that are based on Document Types. Using code like the following, I've been able to add the Permissions for Modules where ResourceName is the code name for the Module, and PermissionName is a Permission defined for the Module:
PermissionNameInfo permission = PermissionNameInfoProvider.GetPermissionNameInfo(PermissionName, ResourceName, null);
if (permission != null)
RolePermissionInfo newRolePermission = new RolePermissionInfo();
newRolePermission.PermissionID = permission.PermissionId;
newRolePermission.RoleID = RoleID;
But I have been unable to get it to successfully add Permissions for Document Types. I've tried using the same code just using the Document Type code name for ResourceName (I've also tried it for the ClassName parameter), but it does not work. Is there a different method that should be used for assigning Permissions for Document Types to a Role? Or is it not possible to do through the API?