Error OnPreRender: Ambiguous match found

Published 16 September 09 07:51 PM

MOSS April Update [968850] is causing compatibility issues. (http://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 http://accesschecker.codeplex.com/WorkItem/View.aspx?WorkItemId=4465

STSADM Extenstions at http://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

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

About Stian Kirkeberg

Stian Kirkeberg - Senior Consultant, Microsoft Consulting Services

This Blog

Syndication

Page view tracker