Tag Info

New answers tagged

0

First, if this is your real production code, you should really consider adding error handling with at least a try/catch blog and log the error to the SharePoint ULS log. Second, your code fails because it assumes that the feature activation happens while on a particular SharePoint web site: SPSite site = properties.Feature.Parent as SPSite; If activating ...


0

As, suggested by Shailen, get the user's Id and update the author field. Check the sequence of 'EventFiringEnabled' to make sure your code is running after SP's. item[SPBuiltInFieldId.Author] = userId; item.SystemUpdate(false); Also, make sure you're wrapping your code inside SPSecurity.RunWithElevatedPrivileges(delegate() { ... });


0

Have you tried properties.CurrentUserId and explicity pass that to the Created property of the new listitem ?



Top 50 recent answers are included