SPUsageSettings Class
The SPUsageSettings class encapsulates settings for usage analysis and logging in the Microsoft Windows SharePoint Services deployment.
System.Object
Microsoft.SharePoint.Administration.SPUsageSettings
Public Fields
The following table shows the public fields of the SPUsageSettings class and a brief description of each.
| Name | Description |
|---|---|
| MaxNumberLogFiles | Indicates the maximum number of log files that can be created during logging. |
Public Methods
The following table shows the public methods of the SPUsageSettings class and a brief description of each.
| Name | Description |
|---|---|
| SetProcessingInterval | Specifies the start and end times of the interval within which usage analysis processing starts each day. |
| Update | Updates the database with changes made to the usage analysis settings. |
Public Properties
The following table shows the public properties of the SPUsageSettings class, the data type of each property, and a brief description of each.
| Name | Data Type | Description |
|---|---|---|
| LogFilesDirectory | String | Gets or sets the location where usage analysis log files are created. |
| LoggingEnabled | Boolean | Gets or sets a Boolean value that specifies whether usage analysis logging is enabled. |
| NumberLogFiles | UInt32 | Gets or sets the number of log files to use in usage analysis per virtual server. |
| ProcessingEndTime | System.DateTime | Gets the end of the time interval within which usage processing starts each day. |
| ProcessingStartTime | System.DateTime | Gets the start of the time interval within which usage processing starts each day. |
| UsageProcessingEnabled | Boolean | Gets or sets a Boolean value that specifies whether usage analysis processing is enabled. |
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
Use the UsageSettings property of the SPGlobalAdmin class to get an SPUsageSettings object that represents the settings for usage analysis processing. To make changes to usage settings, do not call members of this class directly off the UsageSettings property, but instead instantiate an SPUsageSettings object and assign the property to this object. The following code does not update settings because it creates two separate SPUsageSettings objects:
SPGlobalAdmin globalAdmin = new SPGlobalAdmin(); globalAdmin.UsageSettings.SetProcessingInterval(1, 15, 1, 15); globalAdmin.UsageSettings.Update();
The following code successfully modifies usage settings:
SPGlobalAdmin globalAdmin = new SPGlobalAdmin(); SPUsageSettings usageSettings = globalAdmin.UsageSettings; usageSettings.SetProcessingInterval(1, 15, 1, 15); usageSettings.Update();
Example
The following code example uses members of the SPUsageSettings class to modify usage analysis processing settings.
Requirements
Namespace: Microsoft.SharePoint.Administration
Platforms: Microsoft Windows Server 2003
Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)
Security: Code Access Security