aproved Version after next change

Jul 5, 2012 at 2:30 PM

Hi everybody,

this solution is quite good for me, except one thing:

To get a version aproved, i have to release a new "Main Version" and have my aproval process.

Before the Document is aproved, there is only the "current Version" field working, because there is no approved version.

After the Aproval, the colums aproved version are filled and the text field ist working, but to get it in the document, i have to change and check in a new document.

So what meant to be the version 1.0 (with this version on its titelpage) is checked in in sharepoint as 1.1...

Is there a solution to get the version befor the aproval in the document?

Aug 11, 2016 at 12:28 PM
The following replacement of the Current Version assignment fixed this for me:
int beforeLevel = (int.TryParse(properties.BeforeProperties["vti_level"].ToString(), out beforeLevel) ? beforeLevel : -1);
int afterLevel = (int.TryParse(properties.AfterProperties["vti_level"].ToString(), out afterLevel) ? afterLevel : -1);

if (item["_UIVersionString"] != null && !string.IsNullOrEmpty(item["_UIVersionString"].ToString()))
{
    // If check in major version
    if ((beforeLevel == 255 && afterLevel == 1) || (beforeLevel == 2 && afterLevel == 2))
    {
        int major = int.Parse(item["_UIVersionString"].ToString().Split('.')[0]);
        int minor = int.Parse(item["_UIVersionString"].ToString().Split('.')[1]);
        minor = 0;
        major++;
        item["Current Version"] = string.Format("{0}.{1}", major, minor);
    }
    else
    {
        item["Current Version"] = item["_UIVersionString"].ToString();
    }
}