<?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 Getting UserName and UserID from Connection Object in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/getting-username-and-userid-from-connection-object/m-p/6958855#M7701</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get the currently logged in&amp;nbsp;UserName and UserID to display in a message box using the API in Vault 2016 using VB.&amp;nbsp; I started by writing my own version of&amp;nbsp;a "Hello World" app that displays a message box from a command I inserted in the File menu.&amp;nbsp; It works fine until I try to display UserName and UserID in the message box using the connection object.&amp;nbsp; When I try to&amp;nbsp;run the code below, nothing happens.&amp;nbsp; I'm sure it's something simple that I'm&amp;nbsp;missing but don't know what it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Imports&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; ADCFV = Autodesk.DataManagement.Client.Framework.Vault&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Namespace&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; VaultAPItesting&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp; Public&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Class&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;VaultAPItestingCommandExtension&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Implements&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;IExplorerExtension&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; m_conn &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; ADCFV.Currency.Connections.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Connection&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp; Public&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Sub&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; CommandExecute(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;ByVal&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; sender &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Object&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;ByVal &lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;e&amp;nbsp;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;nbsp;Autodesk.Connectivity.Explorer.Extensibility.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;CommandItemEventArgs&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(&lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Current UserID: "&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; &amp;amp; m_conn.UserID.ToString &amp;amp; vbCrLf &amp;amp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Current UserName: "&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; &amp;amp; m_conn.UserName)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'MessageBox.Show("Hello World!")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;End&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Sub&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2017 15:53:48 GMT</pubDate>
    <dc:creator>John204</dc:creator>
    <dc:date>2017-03-20T15:53:48Z</dc:date>
    <item>
      <title>Getting UserName and UserID from Connection Object</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/getting-username-and-userid-from-connection-object/m-p/6958855#M7701</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get the currently logged in&amp;nbsp;UserName and UserID to display in a message box using the API in Vault 2016 using VB.&amp;nbsp; I started by writing my own version of&amp;nbsp;a "Hello World" app that displays a message box from a command I inserted in the File menu.&amp;nbsp; It works fine until I try to display UserName and UserID in the message box using the connection object.&amp;nbsp; When I try to&amp;nbsp;run the code below, nothing happens.&amp;nbsp; I'm sure it's something simple that I'm&amp;nbsp;missing but don't know what it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Imports&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; ADCFV = Autodesk.DataManagement.Client.Framework.Vault&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Namespace&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; VaultAPItesting&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp; Public&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Class&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;VaultAPItestingCommandExtension&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Implements&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;IExplorerExtension&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; m_conn &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; ADCFV.Currency.Connections.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Connection&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp; Public&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Sub&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; CommandExecute(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;ByVal&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; sender &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;As&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Object&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;ByVal &lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;e&amp;nbsp;As&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;nbsp;Autodesk.Connectivity.Explorer.Extensibility.&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;CommandItemEventArgs&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(&lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"Current UserID: "&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; &amp;amp; m_conn.UserID.ToString &amp;amp; vbCrLf &amp;amp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Current UserName: "&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; &amp;amp; m_conn.UserName)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'MessageBox.Show("Hello World!")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;End&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;Sub&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 15:53:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/getting-username-and-userid-from-connection-object/m-p/6958855#M7701</guid>
      <dc:creator>John204</dc:creator>
      <dc:date>2017-03-20T15:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Getting UserName and UserID from Connection Object</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/getting-username-and-userid-from-connection-object/m-p/6961820#M7702</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your Vault Extension contains a 'OnLogOn' method which needs to be implemented by&amp;nbsp;the IExplorerExtension interface. You can access the Connection object from the IApplication interface and store it in a variable during login. The Connection object contains the Server, UserName, UserID, Vault, etc properties that you need. See a sample below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    Public Class HelloWorldCommandExtension
        Implements IExplorerExtension

        Private _connection As Autodesk.DataManagement.Client.Framework.Vault.Currency.Connections.Connection

        Public Sub OnLogOn(application As IApplication) Implements IExplorerExtension.OnLogOn
            _connection = application.Connection
        End Sub

        Private Sub HelloWorldCommandHandler(s As Object, e As CommandItemEventArgs)
            Try
                MessageBox.Show(String.Format("UserName: {0}, UserID:{1}", _connection.UserName, _connection.UserID.ToString()))
            Catch ex As Exception

            End Try
        End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 16:11:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/getting-username-and-userid-from-connection-object/m-p/6961820#M7702</guid>
      <dc:creator>psaarloos</dc:creator>
      <dc:date>2017-03-21T16:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Getting UserName and UserID from Connection Object</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/getting-username-and-userid-from-connection-object/m-p/6962080#M7703</link>
      <description>&lt;P&gt;Works great.&amp;nbsp; Thank you, Pim!!!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 17:15:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/getting-username-and-userid-from-connection-object/m-p/6962080#M7703</guid>
      <dc:creator>John204</dc:creator>
      <dc:date>2017-03-21T17:15:14Z</dc:date>
    </item>
  </channel>
</rss>

