I've using the following code to save the week a user is currently looking at, for next time they view the web part:
private string _week = null;
[WebPartStorage(Storage.Personal)]
public string Week
{
get
{
if (string.IsNullOrEmpty(_week))
{
_week = DateTime.Now.WeekStart(Const.StartOfWeek);
}
return _week;
}
set
{
_week = value;
}
}
WeekStart is an extension method that returns a string date. Let's assume I'm using a string instead of a date for Good Reasons.
When the following method is called by the 'One week forward' button being clicked, the updated property is saved but only for administrators. For everyone else it fails to save the property:
private void rightArrowClick(object sender, System.EventArgs e)
{
Week = Week.AddDays(7);
SaveProperties = true;
}
Am I misunderstanding the purpose of Storage.Personal, or do the normal users need more permissions than the Contributor role allows in order for this to work?