+-------------------- FILEEXPORTER: COPYRIGHT NOTICE --------------------+
| Copyright (C) Ezra Kenigsberg 2016 |
| Permission is hereby granted, free of charge, to any person obtaining |
| a copy of this software and associated documentation files (the |
| "Software"), to deal in the Software without restriction, including |
| without limitation the rights to use, copy, modify, merge, publish, |
| distribute, sublicense, and/or sell copies of the Software, and to |
| permit persons to whom the Software is furnished to do so, subject to |
| the following conditions: |
| |
| The above copyright notice and this permission notice shall be |
| included in all copies or substantial portions of the Software. |
| |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
+------------------------------------------------------------------------+
REQUIREMENTS
1) Windows XP (or above)
2) A Salesforce login with API access
3) Apex Data Loader 17 (download the installer from
HOW TO USE FILEEXPORTER
1) Download the zipfile from http://bit.ly/fileexporter (if Windows Defender refuses save that link, try right-clicking it and selecting "Save link as..." or "Save target as...". You're overriding virus- checking by doing this, so you may want to scan the file once it's downloaded by right-clicking it and selecting "Scan with Windows Defender...").
2) Unzip all files from the FileExporter zipfile to a folder on your
hard drive.
3) Double-click +FileExporter.bat.
4) Respond to onscreen prompts. Some options are shown in parentheses; do
not type parentheses when providing your responses.
FREQUENTLY-ASKED QUESTIONS
Q: "Why hasn't FileExporter worked for me since August 2015?"
A: Salesforce improved its Security Certificates in August 2015 (see
In order to use FileExporter now, you need to update Data Loader 17's
certificates, which requires having administrator privileges on your PC.
If you have administrator privileges, here's how you do this:
1) Navigate to your computer's "C:\Program Files (x86)\salesforce.com\
Apex Data Loader 17.0\_jvm\lib\security" directory, right-click the
"cacerts" file, and select "Properties".
2) In the "Properties" window for the "cacerts" file, deactivate the
"Read-only" checkbox and click "OK".
3) Download http://bit.ly/newcertificate. Name it
"VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem" and
save it in your computer's "C:\Program Files (x86)\salesforce.com\Apex
Data Loader 17.0\_jvm\bin" directory.
4) Navigate to your computer's "C:\Program Files (x86)\salesforce.com\Apex
Data Loader 17.0\_jvm\bin" directory and click
"File|Open command prompt|Open command prompt as administrator".
5) Copy and paste the following line into the Command Window:
keytool -import -keystore ..\lib\security\cacerts -file "VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem" -alias vsignc3g5 -storepass changeit
6) When the Command Window asks you "Trust this certificate?", type Y and
press Enter.
7) Close the Command Window.
You're good to go!
Q: "How does FileExporter work?"
A: FileExporter is a command-line utility (ie, a program in a text window)
that automates Data Loader. Neither Salesforce nor Data Loader needs to
be open on your PC when you run FileExporter. Once run, FileExporter
will need to know responses to several questions displayed in the text
window, including username, password, and security token (if required).
Q: "Does FileExporter work with Data Loader version [X]?"
A: FileExporter works best with Data Loader version 17. It won't work at
all with any version after 23. Download installers for Data Loader here:
Q: "When I run FileExporter, it says 'The system cannot find the path
specified.' What does that mean?"
A: FileExporter needs to be told where Data Loader is installed on your PC.
By default, it assumes "C:\Program Files\salesforce.com\Apex Data
Loader 17.0". FileExporter's default path can also be customized by
editing the fourth line of the "+FileExporter.bat" file in Notepad.
Q: "How can I tell if FileExporter is working properly?"
A: FileExporter writes detailed status messages to a file called "log.txt".
That file is automatically deleted when you quit FileExporter, but you can
override that behavior by editing the fifth line of the "+FileExporter.bat"
file in Notepad (change "SET SaveLog=n" to "SET SaveLog=y").
Q: "How do I get FileExporter to download Files?"
A: The documents stored in Salesforce's Files tab are a kind of Content, and
will be downloaded when you use FileExporter to download Content.
Q: "Can FileExporter export files in all languages?"
A: Yup. If you're exporting files in a non-Western language (eg, Japanese),
you will need to change each instance of
<entry key="dataAccess.writeUTF8" value="true"/>
in the "beans.xml" file to instead read
<entry key="dataAccess.writeUTF8" value="false"/>
(Thanks to Kenji Taniguchi for his insight!)
Q: "My downloaded Attachments/Content/Documents are empty! (Or I'm getting
Microsoft VBScript runtime errors.) What's wrong?"
A: One thing to try first: make sure your folder path doesn't have unusual
characters in it (thanks to Aukrit Unahalekhaka for noticing the problem
with ampersands).
Also: lately people have been getting heap errors. I've implemented fixes
(thanks to Sanket Deshmukh and Michael Fitzgerald!) that should help
MOST of the time. Download and use the latest version. If you're still
getting zero-byte extracted CSVs or empty Attachments/Content/Documents,
try one of the following three procedures:
A) restart your computer and, without opening any other applications, run
FileExporter. (I know this is a dopey solution. Suggestions on how to
get Data Loader to better handle java heap space are appreciated.)
B) export a smaller group of Attachments/Content/Documents; see the last
Q&A, "Which files does FileExporter download?" below, for examples.
C) run manual steps to pick up where FileExporter likely crashed:
1) open a Command Prompt
2) in the Command Prompt, navigate to the "FileExporter" folder
3) for Attachments:
type "cscript Step3a-ReadBody" (without the quotation marks)
for Content:
type "cscript Step3cv-ReadBody" (without the quotation marks)
for Documents:
type "cscript Step3d-ReadBody" (without the quotation marks)
4) close the Command Prompt
5) for Attachments:
double-click "Step4a-DecryptBody.bat"
for Content:
double-click "Step4cv-DecryptBody.bat"
for Documents:
double-click "Step4d-DecryptBody.bat"
6) for Attachments:
(skip this step)
for Content:
double-click "Step5cv-ReplaceFileType.bat"
for Documents:
(skip this step)
7) for Attachments:
(skip this step)
for Content:
double-click "Step6cv-AddFileType.bat"
for Documents:
double-click "Step6d-AddType.bat"
8) for Attachments:
double-click "Step7a-RenameFile.bat"
for Content:
double-click "Step7cv-RenameFile.bat"
for Documents:
double-click "Step7d-RenameFile.bat"
Q: "In which folder are the Attachments/Content/Documents downloaded?"
A: By default, the downloaded files are extracted to a subfolder of
FileExporter's location, either "Exported Attachments", "Exported
Content", or "Exported Documents". The raw CSVs extracted from
Salesforce are saved to a subfolder called "CSVs". Right before
quitting, FileExporter offers the option to move the files to another
location.
Q: "How fast is FileExporter?"
A: FileExporter's speed depends on the number of documents, the size of the
documents, and your internet connection speed. After downloading data
from Salesforce, FileExporter needs a few extra moments (usually no more
than one minute) to convert the data into distinct files.
Q: "Which files does FileExporter download?"
A: FileExporter downloads ALL files of the object type selected (Attachments,
Content, or Documents). There is no interface to download specific files.
HOWEVER, the first line of the "beans.xml" configuration file can be
modified to download solely the files you want.
Example #1: let's say I only want to download Attachments created on or
after December 31, 2012. I need to change the first line of "beans.xml",
the one that reads
<!ENTITY whereClause "CreatedDate>1900-01-01T00:00:00.000Z">
to instead read
<!ENTITY whereClause "CreatedDate>2012-12-31T00:00:00.000Z">
The ">" is the way you write a "greater-than" symbol in an XML file.
Example #2: if I only want to extract Accounts' Attachments, I would
change the "CreatedDate>1900-01-01T00:00:00.000Z" clause in the first
line of "beans.xml" to instead read "Parent.Type IN ('Account')".
Example #3: if I only want to extract Excel Attachments, I would change
the "CreatedDate>1900-01-01T00:00:00.000Z" clause in the first line of
"beans.xml" to instead read "Name LIKE '%.XLS' OR Name LIKE '%.XLSX'".
This doesn't cover everything, but hopefully it'll be enough to get you
started. You can try using Data Loader or Force.com Explorer to create
SOQL queries via trial and error, too.
CREDITS
I owe many thanks to...
...Sanket Deshmukh for his help with command-line switches
...Michael Fitzgerald for his VBScript code improvements
...Ritchie Lawrence for his MTEE utility
...Mike Meyer for his testing and documentation
The app wouldn't be the same without you! And if you've got a good idea,
please let me know. Open-source software depends on user feedback!
FEEDBACK
Questions/bug reports/suggestions? Email acumen@gmail.com. Thanks!
|