A followup to this post:
The PortalRight enumeration defined in Microsoft.Sharepoint.Portal.Security is, for some reason, derived from UInt32 rather than Int32. You can see this in the Object Browser when in a VB.NET project.
This anomaly – nothing more than a raised eyebrow in a C# project – seems to be crippling in a VB.NET project.
Whenever I try to use this enum in code, the compiler claims that it can’t cast from Integer to PortalRight – even I always use the enum:
Dim acc as AreaAccessControl = new AreaAccessControl(ctx, PortalRight.ViewArea, myArea.ID)
Gives a compiler error in VB.NET, but works fine in C# – even though the second parameter is defined as PortalRight.
Casting it to UInt32 simply gives a “Can’t convert UInt32 to PortalRight”.
The only way I could get it to compile (didn’t check if it worked) is by doing Enum.Parse on PortalRight.ViewArea.ToString(), which is just SO wrong.
Anyone know why this is so?