I am trying to create some user-defined permissions for an add-on in C#. While trying to create them, contrary to the SDK documentation, apparently the Levels property of the UserPermissionTree is now read-only. Here's my code, maybe someone can confirm this problem/change of behaviour, or point out the correct way to create child permissions, as it is possible in the UI.
UserPermissionTree oPermission = (UserPermissionTree)oCompany.GetBusinessObject(BoObjectTypes.oUserPermissionTree);
oPermission.PermissionID = permissionID;
oPermission.Name = description;
oPermission.Options = options;
if (parentID != null)
//oPermission.Levels = 2; // "this property cannot be assigned to"
oPermission.ParentID = parentID;
result = oPermission.Add();