Posted 10/11/2006 3:51:02 PM | | | | In Microsoft CRM, users have a certain number of personal settings they can update. An example of a user setting is the number of records per page the user wants to see in a grid. However there is an important limitation associated with user settings: developers cannot add new ones for their own purpose. Our SDK solves this problem by allowing you to save and read User Preferences (we call them 'preferences' to prevent any confusion with the 'settings'). The preferences are loaded and cached in memory and therefore are very fast to access. However, because they are in memory, I recommended that you use it only for a few small values and not for storing large amount of data. Just be reasonable! There are three methods that you can use to read and save preferences: - GetPreference(preferenceName)
- RemovePreference(preferenceName)
- SetPreference(preferenceName, preferenceValue)
Here are examples: Instance.CurrentUser.SetPreference("FavoriteColor", "Green");string favoriteColor = Instance.CurrentUser.GetPreference("FavoriteColor"); Instance.CurrentUser.RemovePreference("FavoriteColor"); Behind the scenes, the preferences are saved in small XML files in a folder called 'UserPreferences' off of the root of your solution. I have noticed that this folder is not included in the current release of the SDK. I will make sure that this is corrected in the next release but in the mean time, you will need to create it manually. IMPORTANT: Since each user will be updating their preference XML file, you need to make sure that you grant your users the ability to read and write in this folder.
|
| |
|