UserPreference.SetUserPreference Method (UserPreference, SPWeb)
Stores the Search user preference information to the Search administration database.
Namespace: Microsoft.Office.Server.Search.Administration
Assembly: Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)
Syntax
'Declaration
Public Shared Sub SetUserPreference ( _
preference As UserPreference, _
web As SPWeb _
)
'Usage
Dim preference As UserPreference
Dim web As SPWebUserPreference.SetUserPreference(preference, _
web)
public static void SetUserPreference(
UserPreference preference,
SPWeb web
)
Parameters
preference
Type: Microsoft.Office.Server.Search.Administration.UserPreferenceThe Search preference to store.
web
Type: Microsoft.SharePoint.SPWebThe web that hosts the Search center.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | web is null . -or- Tpreference is null . -or- The system ID of the user is null . |
UnauthorizedAccessException | The current user does not have permission to update the preference. |
UpdatedConcurrencyException | Update failed due to incorrect version number. |
Remarks
This method stores the Search preference information to the Search administration database, and then updates it to the cache. Only the authenticated user who has permission to set the preference can update the preference.