다음을 통해 공유


Error OnPreRender: Ambiguous match found

MOSS April Update [968850] is causing compatibility issues. (https://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=971538)

 

This error is caused by an update on the SPUtility.GetPermissions() method when you try to access the method through use of System.Reflection;

MethodInfo getPermissions =
typeof(SPUtility).GetMethod("GetPermissions",
BindingFlags.NonPublic |
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.InvokeMethod |
BindingFlags.Static);

 

The method is now overloaded, so you will need to specify which one you want. You can do this by using an overloaded method of GetMethod(). (Ironic? :)

Try updating your code with something like this, if you just want to fix the error and not worry about the update/new overloads:

MethodInfo getPermissions =
typeof(SPUtility).GetMethod("GetPermissions",
BindingFlags.NonPublic |
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.InvokeMethod |
BindingFlags.Static,
null,
new Type[] {typeof(SPUserToken), typeof( ISecurableObject)},
null);

Type.GetMethod at MSDN explain the usage of the parameters if you are interested in looking further into it.

To access the overloaded methods you will need to use a Reflector.

 

A couple of places that have used this method and run into the problem are:

SharePoint Access Checker Web Part at https://accesschecker.codeplex.com/WorkItem/View.aspx?WorkItemId=4465

STSADM Extenstions at https://stsadm.blogspot.com/2007/10/enumerate-effective-base-permissions.html

 

 

Note: The GetPermissions() is marked with internal  if you are not sure what this means you should take a look at Access Modifiers

Comments

  • Anonymous
    September 02, 2010
    Thanks so much for this post!  This change (to the SharePoint API) created a huge issue for us and your updated method was just the answer we needed!