Can I change Stat of Item and check out files with Ilogic?

Can I change Stat of Item and check out files with Ilogic?

Darkforce_the_ilogic_guy
Advisor Advisor
419 Views
4 Replies
Message 1 of 5

Can I change Stat of Item and check out files with Ilogic?

Darkforce_the_ilogic_guy
Advisor
Advisor

I have use this code to stop I ligoc code form running on files that I do not have check out , But is it possible to make that open Item and check the file out ? in one go ?.. maybe get a selece tool when running the code .. and then select if you want a quick change or a Work in Progress ... and  then also check the file out to the user

 

Sub Main()
	Logger.Info("Start Surface", filename)

	Dim Connection As VDF.Vault.Currency.Connections.Connection = edm.EdmSecurity.Instance.VaultConnection()
	If Connection Is Nothing Then
		MsgBox("No vault connection...")
		Exit Sub
	End If
	'Check if file is checked out by me or file doesn't exist in vault
	
	If FileCheckedOutByMe(Connection, ThisDoc.Document.FullFileName)
	
	'MsgBox("is check out to me")
	Else
		Exit Sub
		MsgBox("is not check out")
	End If 
end sub



Function FileCheckedOutByMe(conn As VDF.Vault.Currency.Connections.Connection, fileName As String)
	Try
	Dim oFileInfo As New System.IO.FileInfo(fileName)
	Catch
		Return True
	End Try
	Dim oVaultFileName As String
	Dim oWF As String = conn.WorkingFoldersManager.GetWorkingFolder("$/").FullPath
	If fileName.ToLower().Contains(oWF.ToLower()) Then
		oVaultFileName = fileName.Replace(oWF, "$/").Replace("\", "/")
	Else
		'File Not in vault
		Return True
	End If
	Dim oWSmgr As Autodesk.Connectivity.WebServicesTools.WebServiceManager = conn.WebServiceManager
	Dim oFile As ACW.File = oWSmgr.DocumentService.FindLatestFilesByPaths(New String() {oVaultFileName }).FirstOrDefault()

	If oFile.Id = -1 Then
		'File Not in vault
		Return True
	End If
	Dim oFileIteration As New VDF.Vault.Currency.Entities.FileIteration(conn, oFile)
	Dim oProps As PropertyDefinitionDictionary = conn.PropertyManager.GetPropertyDefinitions(VDF.Vault.Currency.Entities.EntityClassIds.Files, Nothing, PropertyDefinitionFilter.IncludeAll)
	Dim oVaultStatus As PropertyDefinition = oProps(PropertyDefinitionIds.Client.VaultStatus)
	Dim status As EntityStatusImageInfo = TryCast(conn.PropertyManager.GetPropertyValue(oFileIteration, oVaultStatus, Nothing), EntityStatusImageInfo)
	Dim oCheckoutState As EntityStatus.CheckoutStateEnum = status.Status.CheckoutState
	If oCheckoutState = EntityStatus.CheckoutStateEnum.CheckedOutByCurrentUser
		Return True
	Else
		Return False
	End If
End Function

code 

0 Likes
420 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor
You need/want a command that combines:
1) Change state >> WIP
2)Check out
Is that correct

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 3 of 5

Yes that right. 

and of cause one for quick change as well

0 Likes
Message 4 of 5

That is possible.
For me it is easier to create an add-in for it.
What do you think about that?

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 5 of 5

I am not sure I have the right skill, and I does know have access to the right software to create pungin. but is there a way in iloigc ?

0 Likes