Share via


SPUserCollection.Remove method (Int32)

Removes the user at the specified index in the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Sub Remove ( _
    index As Integer _
)
'Usage
Dim instance As SPUserCollection
Dim index As Integer

instance.Remove(index)
public void Remove(
    int index
)

Parameters

  • index
    Type: System.Int32

    A 32-bit integer that specifies the index.

Exceptions

Exception Condition
SPException

The collection is read-only.

UnauthorizedAccessException

The current user is not a site administrator.

ArgumentException

An attempt was made to remove the last administrator for the farm.

ArgumentOutOfRangeException

The index is outside the allowable range of the collection.

-or-

The collection is empty.

Remarks

This method removes a specified user from the collection. When a user is removed from the collection, all subsequent users move up one index in the collection and the collection count is decremented.

See also

Reference

SPUserCollection class

SPUserCollection members

Remove overload

Microsoft.SharePoint namespace