You are viewing limited content. For full access, please sign in.

Question

Question

Is there a way to get version count in Workflow or SDK?

asked on October 5, 2015

As the title states is there a way to get the current version count through a workflow activity or sdk method? I am currently trying to have working create a new version of a document though in order to make a new version I need to get the current version count and add 1 to it.

0 0

Answer

SELECTED ANSWER
replied on October 5, 2015

In order to create a new version, do this:

doc.Lock(LockType.Exclusive);
doc.CheckOut();

// make your changes to the document here

doc.Comment = "your version comment";
doc.Save();
doc.CheckIn();
doc.Unlock();

 

0 0

Replies

replied on October 5, 2015

Hi Cristobal,

 

You could use the additional properties in the find entry activity to select, "Latest Version Number".

 

 

Cheers,

 

Carl

1 0
replied on October 5, 2015

I'm not sure why you would need the version count to create a new version, but to get the version count with the SDK you would get the DocumentInfo for the document and do this:

if (doc.IsUnderVersionControl)
{
    VersionHistory verHist = doc.GetVersionHistory();
    DocumentVersion latestVersion = verHist.Last();
    int versionNumber = latestVersion.Version;
}

 

0 0
replied on October 5, 2015

Thanks for the replies. I guess I was going about it the wrong way. As a side

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.