At Event Receiver Item Adding I must add name of worker which is adding a items to the list.
Here is my code:
SPListItem item = lstOtherList.Items.Add(); item["Kontrakt"] = properties.AfterProperties["Kontrakt1"]; item["Pracownik"] = properties.AfterProperties["Author"]; item["Dzien"] = dzienStart; item["Procenty"] = properties.AfterProperties["Procenty"]; // item["ID z Czas Pracy Wpisy"] = properties.BeforeProperties["ID"]; dzienStart = dzienStart.AddDays(1.0); item.Update();
I try Title Author but at Event Receiver it doesn't work and puts spaces. How can I get the user?
I was able to do it using the following code in Item Adding:
item["Pracownik"] = properties.UserDisplayName;