1

I'm currently deploying a SharePoint solution with publishing pages. These pages allow the user to select "Do not update the modified-date".
This is solved by a small controll placed on the page.

<ctrl:ModifiedFieldManager FieldName="Modified" runat="server" id="modifiedmanager">
</ctrl:ModifiedFieldManager>

This control creates a checkbox the user can check or not.
If checked the modified field should stay the same. The control derives from "BaseFieldControl".

public override void UpdateFieldValueInItem()
    {
        base.EnsureChildControls();

        if (this.ModifiedFieldManagerBox.Checked)
        {
            this.Value = this.Item["Modified"];
            base.UpdateFieldValueInItem();
        }
        else
        {
            this.Value = DateTime.Now;
        }
    }

The code above is responsible to write the "old" Modified-Date back to the item if checked.

The funny thing about this code is - it works if I'm logged in as admin. As a normal user this code gets executed but the modified date is still the current date and time.

Could anyone give me some advice how to solve this for normal users?

Thx in Advance

Steve

Steve
  • 174
  • 4
  • 15

1 Answers1

0

Generally, you use SystemUpdate to ensure the modified fields are not changed on teh SPListItem

More info

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx

John Ptacek
  • 1,886
  • 1
  • 15
  • 20
  • Can you tie into the event handling for the Lists and call SystemUpdate there? – John Ptacek Jul 18 '11 at 14:59
  • Then I would have to save the value of the checkbox somewhere in the ContentType because at that time I have no access to the controls of the page. – Steve Jul 19 '11 at 07:05
  • I just found out, that the Right "Manage Permissions" is necessary for a user to be able to override the "Changed" field. - very strange – Steve Jul 26 '11 at 09:57