SPUserStorage Class
The SPUserStorage class maintains information about the user of a Web Part Page and the amount of space the user is consuming in bytes.
System.Object
Microsoft.SharePoint.SPUserStorage
Public Properties
The following table shows the public properties of the SPUserStorage class, the data type of each property, and a brief description of each.
Name | Data Type | Description |
---|---|---|
Length | Int64 | Gets the number of bytes that the user is consuming through personalization information for Web Parts on a page. |
UserId | Int32 | Gets the ID of the user associated with the storage object. |
UserName | String | Gets the user name of the user associated with the storage object. |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.
Remarks
This class serves two purposes in managing Web Part personalizations:
- Provides information about the amount of memory consumed by the personalizations of a user.
- Reduces the amount of space used on the server because the UserId property for a user storage object can be passed as the parameter in the DeleteAllPersonalizations method of the SPFile class when deleting the personalizations for a particular user.
Use the LengthByUser property of the SPFile class to return an SPUserStorageCollection object that contains information about each user of a Web Part Page. Use an indexer to return a single user storage object from the collection. For example, if the collection is assigned to a variable named myUserStorages, use myUserStorages[index]
in C#, or myUserStorages(index)
in Visual Basic .NET, where index is the index number of the user storage in the collection. You can also use a foreach statement (For Each in Visual Basic .NET) to iterate through the collection and return the user storage objects.
Requirements
Namespace: Microsoft.SharePoint
Platforms: Microsoft Windows Server 2003
Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)
Security: Code Access Security