If you ever get the error “The system cannot find the path specified. (Exception from HRESULT: 0x80070003)” while adding role assignments to a library or web in SharePoint, then this might help you solve your problem… I was trying to add role assignments to a library (using library.RoleAssignments.Add(newRole)), which had already worked perfectly before, but when trying it this time, I got the error I’ve mentioned before. The key to solving my issue was something that didn’t include paths at all: I just forgot to break the role inheritance of my library. So if you ever encounter this error, just add the following lines, they will most probably solve your issue:
library.BreakRoleInheritance(true);
library.Update();
Subscribe to:
Post Comments (Atom)
4 comments:
I got the same error: "The system cannot find the path specified. (Exception from HRESULT: 0x80070003)", but for me these lines was not enough:
library.BreakRoleInheritance(true);
library.Update();
I tried to add ResetRoleInheritance();, and then it worked. So all looks like that:
lstList.ResetRoleInheritance();
library.BreakRoleInheritance(true);
library.Update();
Thanks for your reply Marius, it might help other people facing this problem!
Thank you very much for this post and for the reply Marius ... it saved my day :)
totally random indeep! My code was working perfectly fine. All of a sudden (don know if it had anything to do with MOSS SP2 install), but started seing this error.
I already had:
library.BreakRoleInheritance(false); //dont want to copy perms from parent
library.Update();
So I had to add the ResetRoleInheritance line to get past this issue.
But for some reason, I still dont see my timer job running. I see it in the operations page, but see some stack trace on
Stack: at Microsoft.SharePoint.Administration.SPPersistedObject.Update()
not sure WTF thats about!
Post a Comment