Difference between revisions of "API Code: Upload File to Custom Field"

From SmartWiki
Jump to: navigation, search
(updating categories)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Deprecated}}
 +
 +
 
The following is an sample of code that would upload a file to a specified field using the [[API]]:
 
The following is an sample of code that would upload a file to a specified field using the [[API]]:
  
Line 12: Line 15:
 
  End If
 
  End If
  
'''Note:''' ''12345'' is the target [[Custom Fields|custom field]] ID and ''98765'' is the Level 1 ID
+
'''Note:''' ''12345'' is the target [[Custom Fields|custom field]] ID and ''98765'' is the Object ID (opportunityid, activityid, userid, companyid, etc.)
 
+
The Custom Field in the uploadFileField function does not require the prefix of "cf_" as is normally required within [[SmartSimple]].
  
 
This [[API]] may not work for files larger than 64MB in size.
 
This [[API]] may not work for files larger than 64MB in size.
  
[[Category:Integration]]
+
==See Also==
 +
* [[API Sample Code]]

Latest revision as of 16:13, 20 July 2017


Ambox warning pn.png This feature is deprecated and should no longer be used, but may still be available for reasons of backwards compatibility.


The following is an sample of code that would upload a file to a specified field using the API:

Dim tk As New SmartComClient.Toolkit
Dim CurrentSession As SmartComClient.Session
Dim rtn As String
Set CurrentSession = tk.LoginUser("alias", "alias.smartsimple.com", "myname@mydomain.com", "mypassword")
If CurrentSession Is Nothing Then
       MsgBox tk.getLastErr()
Else
       rtn = tk.uploadFileField(CurrentSession, 12345, 98765, "d:\temp\sample.pdf")
       MsgBox rtn
End If

Note: 12345 is the target custom field ID and 98765 is the Object ID (opportunityid, activityid, userid, companyid, etc.)

The Custom Field in the uploadFileField function does not require the prefix of "cf_" as is normally required within SmartSimple.

This API may not work for files larger than 64MB in size.

See Also