Share via


SPUserStorage Class

Maintains information about the user of a Web Part Page and the amount of space the user is consuming in bytes.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPUserStorage

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

Syntax

<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class SPUserStorage

Dim instance As SPUserStorage
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPUserStorage

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 Microsoft Visual Basic, 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) to iterate through the collection and return the user storage objects.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPUserStorage Members

Microsoft.SharePoint Namespace