EBDN - Community - Question & Answers

  1. Franco Silveri
  2. VBA Development
  3. Thursday, 29 September 2022
Hello to everyone,
I have the following function implemented in EB VBA for Revision create implemented in our EB server, that is used from server processes to change the revision of a project when we make the check-in function.
This function was working until EB 2021, from EB 2022 MU07 it's stop functioning because it gives an Access denied error on Revision Folder Object. Is there a function that can be used in EB to release the lock of a project?

Thanks to anyone wants to answer me, best regards
Franco

Public Function RevisionCreate(oprj As Project, Optional AutoIncrease As Boolean = True, Optional ByVal RevisionNumber As Integer = 999) As Integer

Dim RevData As RevisionData
Dim Revision As ObjectItem
Dim MaxRev As Integer

oprj.Revisions.RevisionManagement = True

For Each Revision In oprj.Children("Data Revision";).Children
DoEvents
With Revision.Attributes.ItemByID(aucAttrRevisionIndex)
If IsNumeric(.value) Then
If CInt(.value) > MaxRev Then MaxRev = CInt(.value)
End If
End With
Next
If MaxRev + 1 < RevisionNumber Then
AddLog logTError, 1006, "Revision " & RevisionNumber & " doesn't match with project revision (" & (MaxRev) & ";)"
RevisionCreate = 0
Exit Function
End If

'If MaxRev = RevisionNumber Then
' RevisionCreate = MaxRev
' Exit Function
'End If

If RevisionNumber = 0 Then
oprj.Revisions.RevisionManagement = False
Call oprj.Project.Revisions.DeleteZeroRevision
oprj.Revisions.RevisionManagement = True
End If
RevData.Comment = "Revision " & Format(CStr(RevisionNumber), "000";)
RevData.Date = DateValue(Now)
RevData.Initials = Application.Settings.UserShortName
'RevData.ModificationListsExportPath = workingFolderFromPar
RevData.Name = Format(CStr(RevisionNumber), "000";)
'RevData.PrintAllSheetsWithRevision = False
'RevData.RevisionExportPath = workingFolderFromPar
'RevData.RevisionExportType = aucRevisionExportNone
RevData.RevisionFolder = Format(CStr(RevisionNumber), "000";)
RevData.RevisionNames = "001-999"
'RevData.RevisionSheetType = aucRevisionSheetDiagrams
RevData.RevisionType = aucRevisionTypeProject
'RevData.SaveModificationHistoryToRevFolder = False
'RevData.SaveSheetRevisionsAsPdf = True
'RevData.SaveSheetsAsPdfExportPath = workingFolderFromPar
'RevData.SetRevisionAfterExport = True
'RevData.TransportContainerExportPath = workingFolderFromPar
'RevData.WriteModificationLists = True
'RevData.WriteTransportContainer = True
'RevData.ZeroRevisonIsCreated = True

Call oprj.Project.Revisions.Create(RevData)

RevisionCreate = RevisionNumber
End Function