مكسرات (صحيح) ليس له أي تأثير على المستند مجموعة المجلدات الفرعية
-
10-12-2019 - |
سؤال
أحاول كسر الميراث على مجلد فرعي ضمن تعيين مستند باستخدام التعليمات البرمجية التالية.بعد تشغيل الرمز وفحص المجلد الفرعي لمجموعة المستند، يمكنني أن أرى أنه لا يزال يرث من الوالد.هل يمكن لأي شخص أن يرى ما هو الخطأ هنا؟ giveacodicetagpre.
المحلول
You'll want to use i.BreakRoleInheritance(false) on this one, instead of true.
"
When you call SPItem.BreakRoleInheritance(true), you are assigning the list item with unique permissions, while copying existing permissions on the list to the item. Any new permissions added to the item are only applied to the item.
When you call SPItem.BreakRoleInheritance(false), you are assigning the list item with unique permissions. Existing permissions on the list are NOT copied to the list item. Any new permissions added to the item are only applied to the item.
"
نصائح أخرى
Your code should work from what I can see, haven't tested it. But you use i.BreakRoleInheritance(true);
, meaning it will copy all the permissions it has before breaking the inheritance (from the parent). Are you sure it does not say "This folder has unique permissions." when you check the permission of the SubFolders in the GUI?