Naveen - Thursday, April 14, 2011 2:41 AM:
Hi,
I need to generate a weekly report and upload the same into innovator, I have created the report (.xlsx file) and placed it on the server, now when I try to upload this to the innovator using the following code.
Dim ConnectTest As Item = InnovConn.newItem("User", "get")
ConnectTest.setAttribute("select", "default_vault")
ConnectTest.setProperty("id", InnovConn.getUserID())
Dim ConnectTestResult As Item
ConnectTestResult = ConnectTest.apply()
If ConnectTestResult.isError() Then
Return InnovConn.newError("Error: " & ConnectTestResult.getErrorDetail())
End If
Dim vDefaultVault As String = ConnectTestResult.getProperty("default_vault")
Dim fileItem As Item
fileItem = InnovConn.newItem("File", "add")
fileItem.setProperty("filename", "report.xlsx")
fileItem.setProperty("actual_filename", "e:upload
eport.xlsx")
fileItem.setProperty("checkedout_path", "e:upload")
fileItem.attachPhysicalFile( "e:upload
eport.xlsx", vDefaultVault)
fileItem = fileItem.apply()
fileItem = fileItem.apply()
If fileItem.isError() Then
Return InnovConn.newError("Error :" & fileItem.getErrorDetail())
End If
The code creates a file Object, but the actual file is not uploaded into this, there are no errors or exceptions generated.
I have read in API Doc, that "attachPhysicalFile" can only be called from client side is this stopping the file from being uploaded, or am I missing something here?
Thanking you in advance,
Naveen
SamsAn - Sunday, April 17, 2011 5:04 PM:
Hello.
It's possible also to attach a file from a server-side method. See www.aras.comhttp:/.../1264.aspx giving an example of code.
SamsAn.
rootkiter - Wednesday, May 4, 2011 9:55 PM:
You just call method setFileName(path) only.
Ex:
Item fileItem = Inno.newItem("File","add");
fileItem.setFileName(sPath);
fileItem = fileItem.apply();