public List <Autodesk.Connectivity.WebServices.Item> InitVault() { List <Autodesk.Connectivity.WebServices.Item> parts = new List <Autodesk.Connectivity.WebServices.Item>(); List <long> partIds = new List <long>(); string bookmark = string.Empty; SrchStatus status = null; Vault.Results.LogInResult result = VaultLogin(); v_Conn = result.Connection; while (status == null || parts.Count < status.TotalHits) { //Autodesk.Connectivity.WebServices.File[] results = result.Connection.WebServiceManager.DocumentService.FindFilesBySearchConditions(null, null, null, false, true, ref bookmark, out status); Autodesk.Connectivity.WebServices.Item[] results = result.Connection.WebServiceManager.ItemService.FindItemRevisionsBySearchConditions(null, null, false, ref bookmark, out status); if (results != null) { parts.AddRange(results); } else { break; } Console.WriteLine("Total Results: " + parts.Count.ToString() + " TotalHits: " + status.TotalHits.ToString()); } ReadProperties(result.Connection); return(parts); }
/// <summary> /// This function lists all the files in the Vault and displays them in the form's ListBox. /// </summary> public void ListAllFiles() { // For demonstration purposes, the information is hard-coded. VDF.Vault.Results.LogInResult results = VDF.Vault.Library.ConnectionManager.LogIn( "localhost", "Vault", "Administrator", "", VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, null ); if (!results.Success) { return; } VDF.Vault.Currency.Connections.Connection connection = results.Connection; try { // Start at the root Folder. VDF.Vault.Currency.Entities.Folder root = connection.FolderManager.RootFolder; this.m_listBox.Items.Clear(); // Call a function which prints all files in a Folder and sub-Folders. PrintFilesInFolder(root, connection); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error"); return; } VDF.Vault.Library.ConnectionManager.LogOut(connection); }
public KnowledgeMaster(string server, string userName, string userPassword, AuthTyp authType) { VDF.Vault.Currency.Connections.AuthenticationFlags authFlags = VDF.Vault.Currency.Connections.AuthenticationFlags.Standard; if (authType == AuthTyp.ActiveDir) { authFlags = VDF.Vault.Currency.Connections.AuthenticationFlags.WindowsAuthentication; } VDF.Vault.Results.LogInResult result = VDF.Vault.Library.ConnectionManager.LogIn(server, null, userName, userPassword, VDF.Vault.Currency.Connections.AuthenticationFlags.ServerOnly | authFlags, null); if (result.Success == false) { string message = "Login failed"; if (result.Exception == null) { if (result.ErrorMessages.Count > 0) { message = result.ErrorMessages.ElementAt(0).Key.ToString() + ", " + result.ErrorMessages.ElementAt(0).Value; } } else { message = VDF.Library.ExceptionParser.GetMessage(result.Exception); } throw new ApplicationException(message); } AuthenticationType = authType; ServiceManager = result.Connection.WebServiceManager; }
public void Run(ApplicationOptions options) { VDF.Vault.Results.LogInResult result = VDF.Vault.Library.ConnectionManager.LogIn(options.Server, options.KnowledgeVault, options.UserName, options.Password, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, null); if (!result.Success) { if (result.Exception == null) { if (result.ErrorMessages.Count > 0) { string message = result.ErrorMessages.ElementAt(0).Key.ToString() + ", " + result.ErrorMessages.ElementAt(0).Value; throw new ApplicationException(message); } else { throw new ApplicationException("Error connecting to Vault."); } } else { throw result.Exception; } } try { ServiceManager = result.Connection.WebServiceManager; //VSK-223 - Use Encoding SetFileEncodingOption(options); List <string> values = ReadValues(options.FileName); if (0 == values.Count) { throw new ApplicationException(); } if (PropertyType.File == options.PropertyType) { ImportProperty("FILE", options.PropertyName, values.ToArray()); } else if (PropertyType.Item == options.PropertyType) { ImportProperty("ITEM", options.PropertyName, values.ToArray()); } else { ImportProperty("CUSTENT", options.PropertyName, values.ToArray()); } } finally { VDF.Vault.Library.ConnectionManager.CloseAllConnections(); } }
/*****************************************************************************************/ public ServerConnectionHandler(string serverName, string vaultName, string userName, string password) { VDF.Results.LogInResult logInResult = VDF.Library.ConnectionManager.LogIn(serverName, vaultName, userName, password, VDF.Currency.Connections.AuthenticationFlags.Standard, null); if (!logInResult.Success) { throw new ErrorMessageException("Failed to log in to vault: '" + vaultName + "@" + serverName + "' as user: '******'." + Environment.NewLine + string.Join(Environment.NewLine, logInResult.ErrorMessages.Select(lr => lr.Key.ToString() + " - " + lr.Value).ToArray())); } _Connection = logInResult.Connection.AsOption(); }
private void LoginToVault() { VDF.Vault.Forms.Library.Initialize(); Autodesk.DataManagement.Client.Framework.Vault.Results.LogInResult loginResult = Autodesk.DataManagement.Client.Framework.Vault.Library.ConnectionManager.LogIn ("svr19", "Anthro_Vault", "cliftt", "1234", VDF.Vault.Currency.Connections.AuthenticationFlags.ReadOnly, null); if (loginResult.Success) { vaultConnection = loginResult.Connection; } }
public void Run(ApplicationOptions options) { Options = options; VDF.Vault.Currency.Connections.AuthenticationFlags authFlags = VDF.Vault.Currency.Connections.AuthenticationFlags.Standard; if (Options.AuthenticationType == AWS.AuthTyp.ActiveDir) { authFlags = VDF.Vault.Currency.Connections.AuthenticationFlags.WindowsAuthentication; } VDF.Vault.Results.LogInResult result = VDF.Vault.Library.ConnectionManager.LogIn(Options.Server, Options.Vault, Options.UserName, Options.Password, authFlags, null); if (!result.Success) { if (result.Exception == null) { if (result.ErrorMessages.Count > 0) { string message = result.ErrorMessages.ElementAt(0).Key.ToString() + ", " + result.ErrorMessages.ElementAt(0).Value; throw new ApplicationException(message); } else { throw new ApplicationException("Error connecting to Vault."); } } else { throw result.Exception; } } try { ServiceManager = result.Connection.WebServiceManager; Data = ReadData(); if (Options.SchemeType == SchemeType.File) { ProcessFileScheme(); } else if (Options.SchemeType == SchemeType.Item) { ProcessItemScheme(); } } finally { VDF.Vault.Library.ConnectionManager.CloseAllConnections(); } }
public static Vault.Results.LogInResult VaultLogin() { Configuration configuration = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location); Vault.Results.LogInResult result = null; result = Vault.Library.ConnectionManager.LogIn(crypt.DecryptString(configuration.AppSettings.Settings["server"].Value), crypt.DecryptString(configuration.AppSettings.Settings["vault"].Value), crypt.DecryptString(configuration.AppSettings.Settings["username"].Value), crypt.DecryptString(configuration.AppSettings.Settings["password"].Value), Vault.Currency.Connections.AuthenticationFlags.ReadOnly, null); return(result); }
public static Boolean InitServices() { VDF.Vault.Results.LogInResult results = VDF.Vault.Library.ConnectionManager.LogIn( vaultServer, vaultVault, vaultUsername, vaultPassword, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, null ); if (!results.Success) { return(false); } connection = results.Connection; return(true); }
public static List <FileIteration> InitVault(out List <FileIteration> parts) { parts = new List <FileIteration>(); // For Login Sequence to work AdskLicensingSDK_#.dll must be present and referenced in // build events // xcopy "$(ProjectDir)..\..\..\..\bin\$(PlatformName)\AdskLicensingSDK_*.dll" "$(TargetDir)" /y // m_conn = Vault.Forms.Library.Login(null); // m_model = new Forms.Models.BrowseVaultNavigationModel(m_conn, true, true); List <File> files = null; string bookmark = string.Empty; SrchStatus status = null; List <File> totalResults = new List <File>(); Vault.Results.LogInResult result = VaultLogin(); v_Conn = result.Connection; while (status == null || totalResults.Count < status.TotalHits) { File[] results = result.Connection.WebServiceManager.DocumentService.FindFilesBySearchConditions(null, null, null, false, true, ref bookmark, out status); if (results != null) { totalResults.AddRange(results); } else { break; } } ReadProperties(result.Connection); foreach (File f in totalResults) { try { FileIteration fi = new Vault.Currency.Entities.FileIteration(result.Connection, f); //PrintProperties(result.Connection, fi); parts.Add(fi); } catch (Exception ex) { MessageBox.Show(ex.Message); } } return(parts); }
static void Main(string[] args) { VDF.Vault.Results.LogInResult lr = VDF.Vault.Library.ConnectionManager.LogIn ("localhost", "TestVault", "administrator", "", VDF.Vault.Currency.Connections.AuthenticationFlags.ReadOnly, null); if (lr.Success) { m_conn = lr.Connection; VDF.Vault.Forms.Settings.SelectEntitySettings settings = new VDF.Vault.Forms.Settings.SelectEntitySettings(); VDF.Vault.Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter[] filters = new VDF.Vault.Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter[] { new VDF.Vault.Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter("Assembly Files (*.iam)", ".+iam", VDF.Vault.Currency.Entities.EntityClassIds.Files), new VDF.Vault.Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter("Part Files (*.ipt)", ".+ipt", VDF.Vault.Currency.Entities.EntityClassIds.Files) }; VDF.Vault.Forms.Controls.VaultBrowserControl.Configuration initialConfig = new VDF.Vault.Forms.Controls.VaultBrowserControl.Configuration(m_conn, settings.PersistenceKey, null); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.EntityName); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.CheckInDate); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.Comment); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.ThumbnailSystem); initialConfig.AddInitialSortCriteria(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.EntityName, true); settings.DialogCaption = "Select Part or Assembly file to Upload"; settings.ActionableEntityClassIds.Add("FILE"); settings.MultipleSelect = false; settings.ConfigureActionButtons("Upload", null, null, false); settings.ConfigureFilters("Applied filter", filters, null); settings.OptionsExtensibility.GetGridConfiguration = e => initialConfig; Console.WriteLine("Launching Vault Browser..."); VDF.Vault.Forms.Results.SelectEntityResults results = VDF.Vault.Forms.Library.SelectEntity(m_conn, settings); if (results != null) { VDF.Vault.Currency.Entities.FileIteration fileIter = results.SelectedEntities.FirstOrDefault() as VDF.Vault.Currency.Entities.FileIteration; string result = Util.DownloadFilestoFolder(fileIter, m_conn); if (result != "Directory not found") { Task t = Task.Run((Util.UploadAssembly)); t.Wait(); } } } }
public void Run(ApplicationOptions options) { Options = options; VDF.Vault.Currency.Connections.AuthenticationFlags authFlags = VDF.Vault.Currency.Connections.AuthenticationFlags.Standard; if (Options.AuthenticationType == AWS.AuthTyp.ActiveDir) { authFlags = VDF.Vault.Currency.Connections.AuthenticationFlags.WindowsAuthentication; } VDF.Vault.Results.LogInResult result = VDF.Vault.Library.ConnectionManager.LogIn(Options.Server, Options.KnowledgeVault, Options.UserName, Options.Password, authFlags, null); if (result.Success == false) { string message = "Login failed"; if (result.Exception == null) { if (result.ErrorMessages.Count > 0) { message = result.ErrorMessages.ElementAt(0).Key.ToString() + ", " + result.ErrorMessages.ElementAt(0).Value; } } else { message = VDF.Library.ExceptionParser.GetMessage(result.Exception); } Log(MessageCategory.Error, "Error connecting to Vault: {0}", message); return; } try { ServiceManager = result.Connection.WebServiceManager; Data = ReadData(Options.InputFile); Initialize(); ImportFoldersAndProperties(); UpdatePermissionsAndLifecycles(); } catch (Exception ex) { LogError(ex); } finally { VDF.Vault.Library.ConnectionManager.CloseAllConnections(); } }
public VDF.Vault.Currency.Connections.Connection getpsVaultConn(string server, string vault, string uName, string pass) { VDF.Vault.Results.LogInResult results = VDF.Vault.Library.ConnectionManager.LogIn(server, vault, uName, pass, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, null); connection = results.Connection; return(connection); }