New answers tagged


SOLVED: After lengthy research I was able to come up with a working solution. // Break Inheritance from Parent library newFolder.Item.BreakRoleInheritance(true); // Remove 'Visitor' group from permissions SPPrincipal principal = (SPPrincipal)webDst.SiteGroups["Visitor"]; ...


Which event is your Event Receiver trigging on? Because the -ed receivers are asynchronous by default (which could explain the behavior you're seeing). So, either use ItemUpdating event for your receiver, or explicitly mark your ItemUpdated receiver as synchronous (in the XML or code based on how you are adding the receiver) For XML: ...


Just to speed up the code in ItemAdded event, you can pass ListItem.BreakRoleInheritance(false); - false flag will not inherit user/ groups from parent so for look will be avoided. Later you can just start assigning roles to required users.


It is not possible by using Sandbox or Farm solution. You can accomplish this using a workflow using AppStep. Please refer the link for creating the workflow using AppStep Or else try to refresh the page programattically at the end of the ItemAdded event.


You cannot get the item value in ItemAdding event. You can refer this BeforeProperties/AfterProperties in Event Receivers. You can get the Value in ItemAdded event. Let me know your thoughts. Thanks


As you said it yourself in the question that the item has not yet been created hence you won't be able to get the item using properties.Item. If you need to get the values of the columns then you would need to use properties.AfterProperties["ColumnName"] the statement SPListItem item = properties.Item would yield result for you in the ItemAdded event as ...


Just be sure to get the values from ItemAdded event. Because when ItemAdding, the current item is not updated in the list yet and you cannot get the item values. The reason why that the values are not available is because they aren't exist yet.

Top 50 recent answers are included