<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic GetNextRevisionNumbersByMasterIds - not returning any next revision number in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/getnextrevisionnumbersbymasterids-not-returning-any-next/m-p/5638625#M9461</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm executing the next piece of code to get the next revision number for a specific file. The next revision number depends on an Enum variable &lt;EM&gt;nextNumber&lt;/EM&gt;&lt;EM&gt;.&lt;BR /&gt;&lt;/EM&gt;However, what I'm getting in return (i.e. the &lt;EM&gt;nextRevNumber &lt;/EM&gt;variable) is an empty string (""). This method was working on a previous test configuration, but now it doesn't anymore.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe it's also important to note two things:&lt;/P&gt;&lt;P&gt;- First, the problem may lie in the fact that some files don't have a revision definition assigned. But, the question remains; why don't they have a revision definition if they were added throught the same method the others were (they're all .dwg, for example).&lt;/P&gt;&lt;P&gt;- Second, in the Vault Explorer application I can change Revision and easily choose between the Primary, Secondary and Tertiary types. I'm not sure if it's an option in the vault configuration that was changed, though I feel skeptical about it since it works in the Vault Explorer for those same files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public enum RevisionLevel { PRIMARY, SECONDARY, TERTIARY };&lt;/PRE&gt;&lt;PRE&gt;public static string GetNextRevisionByMasterId(long fileMasterId, RevisionLevel nextNumber)
        {
            Autodesk.Connectivity.WebServices.File[] versions =
                _conn.WebServiceManager.DocumentService.GetFilesByMasterId(fileMasterId);

            var revisionDefId = versions[0].FileRev.RevDefId;
            StringArray[] arrayOfNextRevNumb = _conn.WebServiceManager.RevisionService.GetNextRevisionNumbersByMasterIds(
                new long[] { fileMasterId }, new long[] { revisionDefId });

            try
            {
                string nextRevNumber;
                if (nextNumber.Equals(RevisionLevel.PRIMARY))
                    nextRevNumber = arrayOfNextRevNumb[0].Items[0];
                else if (nextNumber.Equals(RevisionLevel.SECONDARY))
                    nextRevNumber = arrayOfNextRevNumb[0].Items[1];
                else
                    nextRevNumber = arrayOfNextRevNumb[0].Items[2];
                return nextRevNumber;
            }
            catch (IndexOutOfRangeException)
            {
                Logger.WriteLine(Log.Error.NextRevisionEx);
                throw new IndexOutOfRangeException(Log.Error.NextRevisionEx);
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 May 2015 00:27:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-05-18T00:27:32Z</dc:date>
    <item>
      <title>GetNextRevisionNumbersByMasterIds - not returning any next revision number</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/getnextrevisionnumbersbymasterids-not-returning-any-next/m-p/5638625#M9461</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm executing the next piece of code to get the next revision number for a specific file. The next revision number depends on an Enum variable &lt;EM&gt;nextNumber&lt;/EM&gt;&lt;EM&gt;.&lt;BR /&gt;&lt;/EM&gt;However, what I'm getting in return (i.e. the &lt;EM&gt;nextRevNumber &lt;/EM&gt;variable) is an empty string (""). This method was working on a previous test configuration, but now it doesn't anymore.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe it's also important to note two things:&lt;/P&gt;&lt;P&gt;- First, the problem may lie in the fact that some files don't have a revision definition assigned. But, the question remains; why don't they have a revision definition if they were added throught the same method the others were (they're all .dwg, for example).&lt;/P&gt;&lt;P&gt;- Second, in the Vault Explorer application I can change Revision and easily choose between the Primary, Secondary and Tertiary types. I'm not sure if it's an option in the vault configuration that was changed, though I feel skeptical about it since it works in the Vault Explorer for those same files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public enum RevisionLevel { PRIMARY, SECONDARY, TERTIARY };&lt;/PRE&gt;&lt;PRE&gt;public static string GetNextRevisionByMasterId(long fileMasterId, RevisionLevel nextNumber)
        {
            Autodesk.Connectivity.WebServices.File[] versions =
                _conn.WebServiceManager.DocumentService.GetFilesByMasterId(fileMasterId);

            var revisionDefId = versions[0].FileRev.RevDefId;
            StringArray[] arrayOfNextRevNumb = _conn.WebServiceManager.RevisionService.GetNextRevisionNumbersByMasterIds(
                new long[] { fileMasterId }, new long[] { revisionDefId });

            try
            {
                string nextRevNumber;
                if (nextNumber.Equals(RevisionLevel.PRIMARY))
                    nextRevNumber = arrayOfNextRevNumb[0].Items[0];
                else if (nextNumber.Equals(RevisionLevel.SECONDARY))
                    nextRevNumber = arrayOfNextRevNumb[0].Items[1];
                else
                    nextRevNumber = arrayOfNextRevNumb[0].Items[2];
                return nextRevNumber;
            }
            catch (IndexOutOfRangeException)
            {
                Logger.WriteLine(Log.Error.NextRevisionEx);
                throw new IndexOutOfRangeException(Log.Error.NextRevisionEx);
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 00:27:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/getnextrevisionnumbersbymasterids-not-returning-any-next/m-p/5638625#M9461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-18T00:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: GetNextRevisionNumbersByMasterIds - not returning any next revision number</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/getnextrevisionnumbersbymasterids-not-returning-any-next/m-p/5639845#M9462</link>
      <description>&lt;P&gt;Does the problem only occur for the files that don't have a revision definition assigned? &amp;nbsp;The behavior you're describing sounds acceptable for files without a revision definition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the question is "why don't they have a revision definition assigned", then you need to give more details relating to that issue. &amp;nbsp;That is, describe the workflow which should result in these files having a revision definition, but results in them having no revision definition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Matt&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 12:56:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/getnextrevisionnumbersbymasterids-not-returning-any-next/m-p/5639845#M9462</guid>
      <dc:creator>smithmat</dc:creator>
      <dc:date>2015-05-18T12:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: GetNextRevisionNumbersByMasterIds - not returning any next revision number</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/getnextrevisionnumbersbymasterids-not-returning-any-next/m-p/5639949#M9463</link>
      <description>&lt;P&gt;Thank you for your reply Matt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found the source of the error by looking at how Vault creates the file. Turns out that Vault, by default, sets the file category to "Base". Well, our Base category has no Revision Scheme defined, therefore it is normal that I was getting the empty string, because of the following line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var revisionDefId = versions[0].FileRev.RevDefId;&lt;/PRE&gt;&lt;P&gt;That is, I was getting the version with Base category, hence no Revision Definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus, the solution became getting the latest version (which already has the desired category and revision definition assigned):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var revisionDefId = versions[versions.Length - 1].FileRev.RevDefId;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 14:19:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/getnextrevisionnumbersbymasterids-not-returning-any-next/m-p/5639949#M9463</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-18T14:19:34Z</dc:date>
    </item>
  </channel>
</rss>

