Hi there.
I have written an event receiver that is activated on the 'ItemAdded' event of a 'Pages' list. The code runs fine, but my issue is this - during the call to my Sub ItemAdded, I want to change the value of a field belonging to the current list item (in this case an aspx page).
The idea is that I can configure the 'Title' field to be another value, which my event receiver configures, and by the time the user sees the page in edit mode, the new title will have been saved for the page. Here is my current attempt:
Public Overrides Sub ItemAdded(ByVal properties As Microsoft.SharePoint.SPItemEventProperties)
Dim newItem As SPListItem = properties.ListItem
Dim currentSiteTitle As String = properties.OpenWeb().Title
UpdateItemTitle(newItem, currentSiteTitle)
newItem.Update()
'newItem.SystemUpdate()
End Sub
As you can see, I've tried both Update() and SystemUpdate(), but in each case, when the user tried to check in the page, they get a message that the page has been modified externally. Plus, when viewing the page, the title field value has not changed.
Is what I'm trying to do at all possible, or is there a better way?
Cheers. Jas.