Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Find Checked Out Files

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
santoshr0114
1149 Views, 9 Replies

Find Checked Out Files

Dear All,

 

My requirement is to find files which is checkedout from a particular folder and filter the results based on Checked Out Date.

 

I can get the checked Out files using the FindFilesBySearchConditions where the condition is CheckOutBy Is Not Empty and sucessfully getting the result.

My code below:

 

Dim filePropDefs AsPropDef() = ServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE") 

Dim checkedOutPropDef AsPropDef = filePropDefs.[Single](Function(n) n.SysName = "CheckoutUserName")

Dim isCheckedOut AsNewSrchCond() With_

{ _

.PropDefId = checkedOutPropDef.Id, _

.PropTyp =

PropertySearchType.SingleProperty, _

.SrchOper = 5, _

.SrchRule =

SearchRuleType.Must _

}

 

Dim bookmark AsString = String.Empty 

Dim status AsSrchStatus = Nothing

Dim files AsList(OfFile) = ServiceManager.DocumentService.FindFilesBySearchConditions(NewSrchCond() {isCheckedOut}, Nothing, Nothing, True, True, bookmark, status).ToList()

 

Manually using the FIND in Vault can specify the Look In path and then set the same Condition and ge the checkedout files

 

How can i point my program to look only in particular directory and get the checkedout files along with checkedoutDate using API?

Am i missing anything?

Regards
Santosh
9 REPLIES 9
Message 2 of 10
Redmond.D
in reply to: santoshr0114

The third parameter is an array of folder IDs.  If that value is set, then the search will only return files in those folders or sub folders.

 

If you want to sort by Check Out Date, then you need to pass in sort criteria to the second parameter.

If you want to add another condition, like seeing only files checked out after a certian date, you need to create another search condition and add it to the array for the first parameter.

 



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 10
santoshr0114
in reply to: Redmond.D

Hello Doug,

 

Thank You for your reply...

 

Will try and get back

Regards
Santosh
Message 4 of 10
santoshr0114
in reply to: santoshr0114

Hello Doug,

 

I didn't know how i missed that, your reply was very much helpful.

But still i am unable to get the CheckedOut Date And Time from result in File()

 

Am i missing anything...

Regards
Santosh
Message 5 of 10
Redmond.D
in reply to: santoshr0114

Checking out a file creates a new version of the file.  The File object represent a specific version of a file.  So, File.CreateDate is the check out time.

 



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 6 of 10
santoshr0114
in reply to: Redmond.D

Dear Doug,

 

I don't think the CreateDate is the checkout date.

Please find the enclosed images

 

The File Vault.PNG has the checked Out File details extracted manually using the Find

The File File.PNG has the details of the specific file(highlighted) during the runtime from Visual Studio Watch Window

 

If you compare you can see that the CheckedOut Date received by manually getting the checkout file details does not match the CreateDate extracted from API. There is not Date Value matching in both the files.

 

This Report is generate during the same time

 

Am i missing anything, or is there a way to get the checked Out Date from somewhere else

Regards
Santosh
Message 7 of 10
santoshr0114
in reply to: Redmond.D

Hi Doug,

I get the previos version created date. Not the current checked out date.

Regards
Santosh
Message 8 of 10
Redmond.D
in reply to: santoshr0114

Hmm, the CreateDate behavior must have changed at some point.  I won't argue with the Visual Studio debugger, so it looks like there is no way to get checkout date from the File object.  You will have to call PropertyService.GetProperties to get the Checked Out value.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 9 of 10
santoshr0114
in reply to: Redmond.D

Hello Doug,

 

Thank you for your reply...

 

I will try and let you know.

Regards
Santosh
Message 10 of 10
santoshr0114
in reply to: santoshr0114

Hello Doug,

It Worked. Using PropertyService.
Thank You
Regards
Santosh

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report