diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb
index 8b51a64b..30ee75b1 100644
--- a/Modules.EDMIAPI/Client.vb
+++ b/Modules.EDMIAPI/Client.vb
@@ -194,9 +194,11 @@ Public Class Client
Try
Dim oNewFile As New Modules.IDB.NewFile(LogConfig, Channel)
Return Await oNewFile.RunAsync(pFilePath, pObjectStoreName, pObjectKind, pBusinessEntity, pImportOptions)
+
Catch ex As Exception
Logger.Error(ex)
Return Nothing
+
End Try
End Function
@@ -204,9 +206,23 @@ Public Class Client
Try
Dim oUpdateFile As New Modules.IDB.UpdateFile(LogConfig, Channel)
Return Await oUpdateFile.RunAsync(pFilePath, pObjectId, pImportOptions)
+
Catch ex As Exception
Logger.Error(ex)
Return Nothing
+
+ End Try
+ End Function
+
+ Public Async Function SetObjectStateAsync(pObjectId As Long, pState As String, Optional pOptions As Options.SetObjectStateOptions = Nothing) As Task(Of Boolean)
+ Try
+ Dim oSetObjectState As New Modules.IDB.SetObjectState(LogConfig, Channel)
+ Return Await oSetObjectState.RunAsync(pObjectId, pState, pOptions)
+
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+
End Try
End Function
@@ -221,9 +237,11 @@ Public Class Client
Try
Dim oImportFile As New Modules.Globix.ImportFile(LogConfig, Channel)
Return Await oImportFile.RunAsync(pFilePath, pProfileId, pAttributeValues, pObjectStoreName, pObjectKind, pBusinessEntity, pImportOptions)
+
Catch ex As Exception
Logger.Error(ex)
Return Nothing
+
End Try
End Function
diff --git a/Modules.EDMIAPI/Client/Options.vb b/Modules.EDMIAPI/Client/Options.vb
index dbb241ce..c16fdaed 100644
--- a/Modules.EDMIAPI/Client/Options.vb
+++ b/Modules.EDMIAPI/Client/Options.vb
@@ -43,6 +43,16 @@
Public Property DateImported As Date = Date.Now
End Class
+ Public Class SetObjectStateOptions
+ Inherits BaseOptions
+
+ '''
+ ''' Date when the file was imported. Can be in the past. Defaults to now.
+ '''
+ Public Property DateImported As Date = Date.Now
+ End Class
+
+
Public Class GetVariableValueOptions
Inherits BaseOptions
End Class
diff --git a/Modules.EDMIAPI/EDMI.API.vbproj b/Modules.EDMIAPI/EDMI.API.vbproj
index 536ddaa3..5cca3097 100644
--- a/Modules.EDMIAPI/EDMI.API.vbproj
+++ b/Modules.EDMIAPI/EDMI.API.vbproj
@@ -80,6 +80,7 @@
+
diff --git a/Modules.EDMIAPI/Modules/IDB/SetObjectState.vb b/Modules.EDMIAPI/Modules/IDB/SetObjectState.vb
new file mode 100644
index 00000000..1b85f4e9
--- /dev/null
+++ b/Modules.EDMIAPI/Modules/IDB/SetObjectState.vb
@@ -0,0 +1,34 @@
+
+Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
+Imports DigitalData.Modules.EDMI.API.Options
+Imports DigitalData.Modules.Logging
+
+Namespace Modules.IDB
+ Public Class SetObjectState
+ Inherits BaseMethod
+
+ Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
+ MyBase.New(pLogConfig, pChannel)
+ End Sub
+
+ Public Async Function RunAsync(pObjectId As String, pState As String, Optional pOptions As SetObjectStateOptions = Nothing) As Task(Of Boolean)
+ Try
+
+ Dim oSql As String = $"EXEC PRIDB_OBJECT_SET_STATE {pObjectId}, '{pState}', '{pOptions.Username}', '{pOptions.Language}'"
+ Dim oResult = Await Channel.ExecuteNonQuery_MSSQL_IDBAsync(oSql)
+
+ If oResult.OK Then
+ Return True
+ End If
+
+ Logger.Warn("Error while setting Object State: [{0}]", oResult.ErrorMessage)
+ Return False
+
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+
+ End Try
+ End Function
+ End Class
+End Namespace