import SQLForce from SQLForce import AttachmentWriter session = SQLForce.Session("MyConnectionParameters") salesforceParentId = '001A0000014fia3' # The unique id of the Salesforce object to own the attachment filename = "/mydir/salesforcecast.docx" # The file to add as an attachment. attachmentId = AttachmentWriter( session, salesforceParentId, filename )
The code that uploads the attachment is the last line -- The only tough part is determining the attachment parent. For a more realistic example that reads the attachment data to upload from a spreadsheet see this longer example.
There's nothing but good news with SQLForce/Python.
- It works on Python 2.3 and 3.3
- It's free and under the EPL..
- Download it here directly from an Amazon/S3 server.
- In addition to the sample scripts there is decent documentation.
No comments:
Post a Comment