SPRoleAssignment Crazy Caveats

I’m not sure if this bug exists on any other environment, but here are a few issues I ran into when trying to use SPRoleAssignment and SPGroup:

  • When trying to use Web.Groups[“GroupName”] it basically told me the group did not exist, so I had to change the code to use Web.SiteGroups[“GroupName”].
  • I could not add the Role Assignment to the Web and run a Web.Update() without adding an additional Web.AllowUnsafeUpdates= true; , however on my virtual machine I could do a Web.Update() without the extra piece of code.  I kept receiving an error in my browser stating that I should hit the back button and update my permissions.

So after fixing those two issues I was able to copy the permissions from a page item into a Site for my migration.  Hopefully, one of you can learn from my error messages if you have any issues in the future.

Technorati Tags: ,,

Print | posted on Friday, March 05, 2010 2:11 PM

Feedback

No comments posted yet.

Your comment:





 
 

Copyright © MOSSLover

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski