Get a File's Status

Get a File's Status

jschierenbeck
Enthusiast Enthusiast
1,216 Views
3 Replies
Message 1 of 4

Get a File's Status

jschierenbeck
Enthusiast
Enthusiast

I am using the Vault SDK to create a search condition to find a "Autodesk.Connectivity.WebServices.File"
I want to check the "FileStatus" property of the found File to see if a out of date version is on on the local disk.
However the "FileStatus" property always returns "Unknown"

 

What would be the reason that the program is not locating the local version of the file?
I tried this example also and I get the same result. It also tells me that the file is not on my local disk when it is.

https://justonesandzeros.typepad.com/blog/2013/08/getting-the-status-icon.html

 

Thanks!

0 Likes
1,217 Views
3 Replies
Replies (3)
Message 2 of 4

Markus.Koechl
Autodesk
Autodesk

I am wondering that you looked at the FileStatus property of the File object. This property is not available for Vault Workgroup and Professional; it is Vault Basic only and reflects a pending update of parent-child-related files.

The local files' status is the property VaultStatus; you need to retrieve it from the file iteration object. Then you get

the StatusImageInfo.Status that shares the information you are looking for.

The code below will run successfully as you replace the server identity, vault, and user information; also replace the path to the sample file.  Copy the code to a new project consuming the Vault SDK template API-Onboarding Console Application. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ACW = Autodesk.Connectivity.WebServices;
using ACWT = Autodesk.Connectivity.WebServicesTools;
using VDF = Autodesk.DataManagement.Client.Framework;
using Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties;

namespace API_Onboarding_CheckFileStatus
{
    class Program
    {
        static void Main(string[] args)
        {
            #region ConnectToVault
            ACW.ServerIdentities mServerId = new ACW.ServerIdentities();
            mServerId.DataServer = "";           //replace value by command line args[i]
            mServerId.FileServer = "";
            string mVaultName = "";
            string mUserName = "";
            string mPassword = "";
            ACW.LicensingAgent mLicAgent = ACW.LicensingAgent.Client;
            ACWT.WebServiceManager mVault = null;
            ACWT.UserPasswordCredentials mCred = null;

            try
            {
                mCred = new ACWT.UserPasswordCredentials(mServerId, mVaultName, mUserName, mPassword, mLicAgent);
                mVault = new ACWT.WebServiceManager(mCred);

                try
                {
                    ACW.ServerIdentities mSrvIdnts = new ACW.ServerIdentities();
                    ///ACWT.UserIdTicketCredentials mCred = new AWT.UserIdTicketCredentials(mSrvIdnts, VaultName, UserId, Ticket);
                    Autodesk.Connectivity.WebServicesTools.WebServiceManager mWsMgr = new ACWT.WebServiceManager(mCred);
                    VDF.Vault.Currency.Connections.Connection mConnection = new VDF.Vault.Currency.Connections.Connection(
                        mWsMgr, mVaultName, mVault.SecurityService.SecurityHeader.UserId, mServerId.DataServer, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard);

                    ACW.File mFile = mVault.DocumentService.FindLatestFilesByPaths(new string[] { "$/Designs/Inventor Sample Data/Fishing Rod Model/01-1136.idw" }).FirstOrDefault();
                    //query data, create files, folders, items... etc. here

                    VDF.Vault.Currency.Entities.FileIteration mFileIteration = new VDF.Vault.Currency.Entities.FileIteration(mConnection, mFile);

                    PropertyDefinitionDictionary mProps = mConnection.PropertyManager.GetPropertyDefinitions(VDF.Vault.Currency.Entities.EntityClassIds.Files, null, PropertyDefinitionFilter.IncludeAll);

                    PropertyDefinition mVaultStatus = mProps[PropertyDefinitionIds.Client.VaultStatus];

                    EntityStatusImageInfo status = mConnection.PropertyManager.GetPropertyValue(mFileIteration, mVaultStatus, null) as EntityStatusImageInfo;

                }
                catch (Exception ex)
                {
                    throw ex;
                }
                //never forget to release the license, especially if pulled from Server
                mVault.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            #endregion connect to Vault
        }
    }
}

 



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes
Message 3 of 4

bradeneuropeArthur
Mentor
Mentor

...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 4

miha_bokan
Enthusiast
Enthusiast

I tried this code, but get an error:
"CS1061 - 'SecurityService' does not contain a definition for 'SecurityHeader' and no accessible extension method 'SecurityHeader' accepting a first argument of type 'SecurityService' could be found (are you missing a using directive or an assembly reference?)

 

did I miss something?

0 Likes