MS windreamKlasse
This commit is contained in:
@@ -379,6 +379,7 @@ Public Class Windream2
|
||||
|
||||
Try
|
||||
oSession = oConnect.Login(oCredentials)
|
||||
_logger.Info("Connected..Session created")
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex, "Error while logging in")
|
||||
Return Nothing
|
||||
@@ -415,7 +416,7 @@ Public Class Windream2
|
||||
Dim oWMObject As WMObject
|
||||
Try
|
||||
oWMObject = GetFileByPath(wmfilepath)
|
||||
_logger.Info($"Changing the archive end-date for file ' & oWMObject.aName & ' Items: {dateFrom_value},{date_period} {date_unit} ")
|
||||
_logger.Info($"Changing the archive end-date for file '{oWMObject.aName}', Items: {dateFrom_value},{date_period},{date_unit}")
|
||||
Try
|
||||
' die Datei sperren
|
||||
oWMObject.LockFor(WMObjectEditModeLifeCycleEdit)
|
||||
@@ -439,6 +440,7 @@ Public Class Windream2
|
||||
|
||||
Dim oArchUntil = DateAdd(oIntervalType, date_period, dateFrom_value)
|
||||
_logger.Debug("New date shall be: " & oArchUntil.ToString)
|
||||
|
||||
oObjectLifecycle.SetPeriodEndDate(2, oArchUntil)
|
||||
_logger.Info("Archive end-date has been changed!")
|
||||
oWMObject.Save()
|
||||
@@ -456,6 +458,63 @@ Public Class Windream2
|
||||
End Try
|
||||
End Function
|
||||
''' <summary>
|
||||
''' changes the archive end date
|
||||
''' </summary>
|
||||
''' <param name="wmfilepath">WM Filepath</param>
|
||||
''' <param name="date_period">number/count of period (if </param>
|
||||
''' <param name="date_unit">date_unity (d,m,y or day(s),month(s),years(s)</param>
|
||||
''' <param name="dateFrom_value">dateFrom_value</param>
|
||||
''' <returns>Returns true when date was set, false if not</returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function NewLifecycle_PeriodTEST(ByVal wmfilepath As String, ByVal oArchUntil As String)
|
||||
Dim oWMObject As WMObject
|
||||
Try
|
||||
oWMObject = GetFileByPath(wmfilepath)
|
||||
_logger.Info($"Changing the archive end-date for file '{oWMObject.aName}', Items: {oArchUntil}")
|
||||
Try
|
||||
' die Datei sperren
|
||||
oWMObject.LockFor(WMObjectEditModeLifeCycleEdit)
|
||||
_logger.Debug(">> object locked")
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
' nichts tun (Datei ist bereits gesperrt)
|
||||
End Try
|
||||
|
||||
Dim oObjectLifecycle = oWMObject.aWMLifeCycle
|
||||
' Dim oDate = CDate(oArchUntil)
|
||||
' Dim omMyFormattedDate = oDate.ToString("dd.MM.yyyy")
|
||||
|
||||
If oArchUntil <> String.Empty Then
|
||||
If IsDate(oArchUntil) Then
|
||||
If CDate(oArchUntil) < CDate(Now) Then
|
||||
_logger.Debug("oArchUntil < today so direct move to archivepool")
|
||||
Else
|
||||
_logger.Debug("New date shall be: " & oArchUntil)
|
||||
oObjectLifecycle.SetPeriodEndDate(2, oArchUntil)
|
||||
_logger.Info("Archive end-date has been changed!")
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
_logger.Debug("oArchUntil is empty so direct move to archivepool")
|
||||
End If
|
||||
|
||||
Dim result = SetArchive_Active(oWMObject)
|
||||
oWMObject.Save()
|
||||
oWMObject.unlock()
|
||||
Return result
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn($"Unexpected Error in NewLifecycle_PeriodTEST {ex.Message}")
|
||||
If Not IsNothing(oWMObject) Then
|
||||
If oWMObject.aLocked = True Then
|
||||
oWMObject.unlock()
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Archives windream object immediately
|
||||
''' </summary>
|
||||
''' <returns>Returns true when archiving was set, false if not</returns>
|
||||
|
||||
Reference in New Issue
Block a user