public void RunCommand(string server, string vault, string username, string password, string rootfolder, Boolean exportdwfs, string property, string propertyvalue) { long propertyid = 0; SecurityService secSrv = new SecurityService(); secSrv.SecurityHeaderValue = new VaultSyncReleased.Security.SecurityHeader(); secSrv.Url = "http://" + server + "/AutodeskDM/Services/SecurityService.asmx"; try { secSrv.SignIn(username, password, vault); DocumentService docSrv = new DocumentService(); docSrv.SecurityHeaderValue = new VaultSyncReleased.Document.SecurityHeader(); docSrv.SecurityHeaderValue.UserId = secSrv.SecurityHeaderValue.UserId; docSrv.SecurityHeaderValue.Ticket = secSrv.SecurityHeaderValue.Ticket; docSrv.Url = "http://" + server + "/AutodeskDM/Services/DocumentService.asmx"; Folder root = docSrv.GetFolderRoot(); //root = docSrv.GetFolderByPath("$/Designs/Designs/C690 T3"); //root = docSrv.GetFolderByPath("$/Amendment"); Document.PropDef[] defs = docSrv.GetAllPropertyDefinitions(); foreach (Document.PropDef pd in defs) { if (pd.DispName.ToString().ToLower() == property.ToLower()) { propertyid = pd.Id; } } if ((property != "") && (propertyid == 0)) { Console.WriteLine("Error: Property notdefined in Vault [" + property + "]"); Console.WriteLine("Properties that ARE defined in Vault [" + vault + "]:"); foreach (Document.PropDef pd in defs) { Console.WriteLine(" " + pd.DispName.ToString()); } } else { ProcessFilesInFolder(root, docSrv, rootfolder, exportdwfs, property, propertyvalue, propertyid); } } catch (Exception ex) { Console.WriteLine("Error: " + ex.ToString()); return; } }
public void RunCommand(string server, string vault, string username, string password, string statename, string statehistname, string state, string checkstates, string newstate, string revertstate, string lifecycledefinition) { long stateid = 0; long statehistid = 0; SecurityService secSrv = new SecurityService(); secSrv.SecurityHeaderValue = new Autodesk.Connectivity.WebServices.SecuritySvc.SecurityHeader(); secSrv.Url = "http://" + server + "/AutodeskDM/Services/SecurityService.asmx"; try { secSrv.SignIn(username, password, vault); DocumentService docSrv = new DocumentService(); docSrv.SecurityHeaderValue = new Autodesk.Connectivity.WebServices.DocumentSvc.SecurityHeader(); docSrv.SecurityHeaderValue.UserId = secSrv.SecurityHeaderValue.UserId; docSrv.SecurityHeaderValue.Ticket = secSrv.SecurityHeaderValue.Ticket; docSrv.Url = "http://" + server + "/AutodeskDM/Services/DocumentService.asmx"; DocumentServiceExtensions docextSrv = new DocumentServiceExtensions(); docextSrv.SecurityHeaderValue = new Autodesk.Connectivity.WebServices.DocumentExSvc.SecurityHeader(); docextSrv.SecurityHeaderValue.UserId = secSrv.SecurityHeaderValue.UserId; docextSrv.SecurityHeaderValue.Ticket = secSrv.SecurityHeaderValue.Ticket; docextSrv.Url = "http://" + server + "/AutodeskDM/Services/DocumentServiceExtensions.asmx"; Folder root = docSrv.GetFolderRoot(); Autodesk.Connectivity.WebServices.PropDef[] defs = docSrv.GetAllPropertyDefinitions(); foreach (Autodesk.Connectivity.WebServices.PropDef pd in defs) { if (pd.DispName.ToString().ToLower() == statename.ToLower()) { stateid = pd.Id; } if (pd.DispName.ToString().ToLower() == statehistname.ToLower()) { statehistid = pd.Id; } } long revertstateid = -1; long newstateid = -1; long newlcdid = -1; LfCycDef[] lifecycledefs = docextSrv.GetAllLifeCycleDefinitions(); foreach (LfCycDef lcd in lifecycledefs) { if (lcd.DispName.ToString().ToLower() == lifecycledefinition.ToLower()) { newlcdid = lcd.Id; } } long[] transitionids = docextSrv.GetAllowedFileLifeCycleStateTransitionIds(); LfCycTrans[] transitions = docextSrv.GetLifeCycleStateTransitionsByIds(transitionids); List<long> tostateidlist = new List<long>(); foreach (LfCycTrans thistransition in transitions) { if (!tostateidlist.Contains(thistransition.ToId)) { tostateidlist.Add(thistransition.ToId); } } long[] tostateids = tostateidlist.ToArray(); LfCycState[] lifecyclestates = docextSrv.GetLifeCycleStatesByIds(tostateids); foreach (LfCycState lcs in lifecyclestates) { if ((lcs.DispName.ToString().ToLower() == newstate.ToLower()) && (newlcdid == lcs.LfCycDefId)) { newstateid = lcs.Id; } if ((lcs.DispName.ToString().ToLower() == revertstate.ToLower()) && (newlcdid == lcs.LfCycDefId)) { revertstateid = lcs.Id; } } if ((statehistid == 0) && (stateid == 0) && (newstateid == -1)) { if (statehistid == 0) Console.WriteLine("Error: \"State (Historical)\" property undefined"); if (stateid == 0) Console.WriteLine("Error: \"State\" property undefined"); if (newstateid == -1) Console.WriteLine("Error: State \"" + newstate + "\" not defined for lifecycle \"" + lifecycledefinition + "\""); } else { ProcessFilesInFolder(root, docSrv, docextSrv, statename, state, stateid, statehistid, checkstates, newstateid, newlcdid, newstate, revertstateid, revertstate, lifecycledefinition); } } catch (Exception ex) { Console.WriteLine("Error: " + ex.ToString()); return; } }