1

In SharePoint i have a document libary. This libary has the following versioning settings.

enter image description here

When the draft document (0.2) is published as major version the history looks like that.

History from SP 2010

After the document is approved. The Version history looks like that.

History from SP 2010

The published 0.2 Version get automaticaly the Version 1.0. But the approver for Version 0.2 is not saved in the history.

Is it possible to store the approver for the document in the version history too?

Because I was wondering that SharePoint 2003 (WSS 3.0) the approver save in the history, like the progress described above.

Here is the same procedure executed in wss3.0

Versionhistory from wss 3.0

The Version 0.2 was published as major version... it get the state "pending" after approving the 0.2, a new version 1.0 was created and added to the history. So the approver would be saved.

//Edit: I added some images to describe the problem.

0

3 Answers 3

0

Can't you see the actual Approver in the Modified By column? At all stages (Check-In Major - aka Submit for Approval) or simply Approving it that column gets updated with the Person doing it.

8
  • Yes but that is the actual state, but I want a histroy for each approved document (e.g. version 1.0 ... version 2.0 and so on).
    – Sascha
    Apr 17, 2013 at 8:43
  • Did you had a look at the Version History page?? Apr 17, 2013 at 11:08
  • yes. I tried the versionhistory from the contextmenue from the file and also from the ribbon menue. I had added my displayed versionhistory in the first post as images.
    – Sascha
    Apr 17, 2013 at 12:05
  • I believe i understand what your actual issue is: the minor version gets promoted as major and you loose track of the version because of this fact. unless you build a handler to track such case, nothing out-of-the-box exists Apr 17, 2013 at 16:49
  • 1
    I must say never did something like that, and i'm pretty sure the same process was valid in WSS v3. i assume one could duplicate the last minor prior in the ItemUpdating/ItemUpdated if the SPModerationStatusType (msdn.microsoft.com/en-us/library/…) Apr 17, 2013 at 19:42
0

So after I Checking some solutions. I decided to create a "custom code solution"....

I Use the Eventreceiver and attach to them the ItemUpdating Event.

The code look like that.

   public override void ItemUpdating(SPItemEventProperties properties)
   {

       // Is Versioning 
       if (properties.Versionless.Equals(false))
       {

           // Check if it is an approval by an user
           if ((properties.BeforeProperties["vti_doclibmodstat"] != properties.AfterProperties["vti_doclibmodstat"])
               &&
               ((properties.AfterProperties["vti_doclibmodstat"].ToString().Equals("0")) || (properties.AfterProperties["vti_doclibmodstat"].ToString().Equals("1"))))
           {
                try
                {

                    // set the new cmomment in the document info panel (Extend it with the approver username)
                    properties.AfterProperties["vti_doclibmodcomm"] += string.Format("\nApproved by: {0}", properties.UserLoginName);

                    // extend the history comment with the approver username
                    properties.AfterProperties["vti_sourcecontrolcheckincomment"] += string.Format("\nApproved by: {0}", properties.UserLoginName);
                }
                catch (Exception ex)
                {
                    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("ApproverEventReceiver", TraceSeverity.VerboseEx, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
                }
           }
       }
       base.ItemUpdating(properties);
   }

This do the following actions:

On each approve, it takes the current Username and attach them to the approver comment. So this would display like this

enter image description here

It also extent the version comment with the sentence "Approved by {UserName}"

enter image description here

I think this is a good solution to track the approvers in sharepoint. So it supports then the ISO process i mean.

2
  • Is good that you end building your own solution following suggestions on the forum, however recognizing those suggestions is all about here! thank for sharing your result nevertheless. Apr 26, 2013 at 11:27
  • I'd like to take a moment to say that this is a great example of why Sharepoint is not ready for real-world use. Simple needs like keeping track of who approved documents should not require writing custom code. Microsoft gets flack about IE, but SharePoint is the real abomination.
    – JohnFx
    Oct 10, 2014 at 19:38
-1

Always use

           ListItem.SystemUpdate(false); 

to update the document library value from draft to Approved. So, there wont be any changes to the version of the document when there is a status change.

The Version history is always available over the Display Form Type of the Particular Document Library. enter image description here

Thanks,

Prasath

6
  • Hi, but I add the document not by code. I add them manualy over the frontend.
    – Sascha
    Apr 17, 2013 at 10:41
  • You have to use some workflows for approving the particular document. so that the status changes to draft to approved. rt? Apr 17, 2013 at 10:49
  • No there is now workflow or s.th. only the standard document list. And the customer showed me the approve progress in wss3.0 (which was installes with project server) there will be stored the approver in the history as seprate history item.
    – Sascha
    Apr 17, 2013 at 10:56
  • Hope, when published as major version and after approval the history takes it as major version document. Thanks Apr 17, 2013 at 11:17
  • Yes but the problem is, that the data is lost who approved the publishing or the username of the pending state is lost. I added a screenshot from wss 3.0. There ist the same procedure executed as described above. But I get a different history display :-(
    – Sascha
    Apr 17, 2013 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.