SPListEvent.UserID Property

NOTE: This API is now obsolete.

Gets the ID of the user whose action triggered the event.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<ObsoleteAttribute("Use V3 style events")> _
Public ReadOnly Property UserID As Integer
    Get
'Usage
Dim instance As SPListEvent
Dim value As Integer

value = instance.UserID
[ObsoleteAttribute("Use V3 style events")]
public int UserID { get; }

Property Value

Type: System.Int32
A 32-bit integer that specifies the ID.

Examples

This example uses the UserID property in an event handler to return the user whose action triggered an event in a document library.

Public Class EventHandler
    Implements IListEventSink

    Public Sub OnEvent(event As SPListEvent)

        Dim site As SPWeb
        Dim user as SPUser

        site = event.Site.OpenWeb()
        user = site.SiteUsers(event.UserID)

    End Sub 'OnEvent

End Class 'EventHandler
public class EventHandler : IListEventSink
{
    public void OnEvent(SPListEvent oEvent)
    {
        using(SPWeb oWebsite = oEvent.Site.OpenWeb())
        {
            SPUser oUser = oWebsite.SiteUsers[oEvent.UserID];
        }
    }
}

Note

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

See Also

Reference

SPListEvent Class

SPListEvent Members

Microsoft.SharePoint Namespace