Message 1 of 5
Can I change Stat of Item and check out files with Ilogic?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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