How to export all your Salesforce data, including emails and attachments

You can export Salesforce records using the built-in Data Export Service in Setup, Data Loader, or an OAuth API extractor, but emails and attachments require querying linked objects separately. Setup exports split archives into 512 MB zip files that expire in 48 hours, while API extraction lets you pull relational records, EmailMessage threads, and ContentVersion binaries on demand with delta sync support before cutover.

Key facts

  • Salesforce Setup Data Export splits archives into roughly 512 MB zip files and deletes them automatically after 48 hours. Source: help.salesforce.com
  • Weekly Data Export runs every 7 days on Enterprise and Unlimited editions, while Professional edition is limited to every 29 days. Source: help.salesforce.com
  • Exporting all organization-wide Salesforce Files via Data Loader or API requires the Query All Files permission on the extracting user. Source: help.salesforce.com
  • Under Section 2.2 of Salesforce's Main Services Agreement (Oct 2026), customers have 30 days after termination to request Customer Data for export before deletion. Source: salesforce.com
A quiet office desk with labeled external backup drives and printed export checklists
On this page

Weekly Data Export vs. Salesforce API extraction

Teams leaving Salesforce have two practical ways to pull their database: the built-in Data Export Service in Setup, or API extraction using Data Loader and OAuth scripts. For a full CRM exit covered in our Salesforce to Odoo migration guide, Setup Data Export works well as an archive backup, while API extraction is what actually powers repeatable trial loads and cutover delta syncs.

Method Best used for Frequency limit Emails and binary files Delta sync support
Setup Data Export One-time safety backup of every object Every 7 days (Enterprise/Unlimited) or 29 days (Professional) Included in 512 MB zip folders if checkbox is ticked No; full snapshot only
Data Loader (Export All) Pulling CSVs of specific objects and archived history On demand within org API limits Exports CSV metadata only; not ideal for bulk binaries Manual SystemModstamp filter
OAuth REST / Bulk API puller Repeatable Salesforce to Odoo migrations On demand within 24-hour API allocations Pulls EmailMessage HTML/text plus ContentVersion binaries Yes; automated incremental sync

Setup Data Export looks deceptively simple when an admin first opens it. You click Export Now, tick Include images, documents, and attachments, and wait for an email. The trouble starts when your org spans several gigabytes or when you need a second refresh three days before go-live and the 7-day or 29-day lock prevents another scheduled run.

Where Salesforce hides emails and file attachments

Most teams assume opportunity files live inside a single Attachments table, which is why DIY CSV exports routinely lose large parts of a company’s quote history. Salesforce splits files and emails across legacy and Lightning data models that must be joined together before importing into Odoo CRM.

Legacy Attachments vs. Salesforce Files (ContentVersion)

Older Salesforce orgs stored uploads in the Attachment object (ParentId pointing straight to an Account or Opportunity). Modern Lightning orgs store almost everything—drag-and-drop files, quote PDFs, and email attachments—as Salesforce Files split across three objects:

  1. ContentDocument: The parent container record representing the logical file.
  2. ContentVersion: Each uploaded revision of that file, holding Title, FileExtension, IsLatest, and the binary VersionData payload.
  3. ContentDocumentLink: The junction table connecting a ContentDocumentId to one or more records via LinkedEntityId (such as an Opportunity, Account, or EmailMessage).

If you export ContentVersion without ContentDocumentLink, you end up with thousands of orphaned PDFs and spreadsheets and no clue which deal they belonged to. Worse, if the extracting user lacks the Query All Files permission in Salesforce Setup, API queries only return files owned by or shared with that single user rather than the entire sales team (Salesforce Help, checked Nov 2026).

EmailMessage vs. Task activity logs

Emails in Salesforce also sit in two places depending on how your reps logged them. Enhanced Email stores full EmailMessage records (Subject, TextBody, HtmlBody, FromAddress, ToAddress, MessageDate, RelatedToId), whereas older Outlook/Gmail sync tools and manual “Log a Call / Email” actions often wrote emails into Task rows with TaskSubtype = 'Email'.

Attachments sent on an EmailMessage link back to that email’s ID through ContentDocumentLink (or Attachment.ParentId) rather than linking directly to the Opportunity. Your extraction script has to walk Opportunity -> EmailMessage -> ContentDocumentLink -> ContentVersion so every email thread and its attached quote PDF land inside the right Odoo chatter thread.

Export limits and timeouts that catch sales teams off guard

Every Salesforce export method enforces hard throttling, size caps, and expiration clocks that stall migrations when discovered on cutover weekend.

  • 512 MB zip splitting and 48-hour expiry: Per Salesforce’s Data Export documentation (checked Nov 2026), Setup packages backup CSVs and binaries into zip files capped at roughly 512 MB each. Those links stay active for only 48 hours before automatic deletion, and triggering a new export immediately deletes any un-downloaded files from the previous batch.
  • One-by-one download throttling: Large orgs can generate dozens of 512 MB archives, and Salesforce restricts users to downloading one zip at a time with a 60-second wait between requests before returning HTTP 429 rate-limit errors.
  • Bulk API 2.0 limits vs. binary files: Bulk API 2.0 supports up to 150,000,000 ingest records and 15,000 shared batches per rolling 24-hour window, making it fast for flat CSV tables. However, Bulk API does not retrieve ContentVersion binary blobs (VersionData), which must be pulled via authenticated REST endpoints while watching daily API call limits.
  • The 30-day post-cancellation cliff: Under Section 2.2 (“Protection of Customer Data”) of the Salesforce Main Services Agreement (Oct 15, 2026 version, checked Nov 2026), customers must request an export within 30 days after contract termination or expiration; after that 30-day period, Salesforce has no obligation to retain Customer Data and deletes it.

How to prepare and verify a complete Salesforce extract

A reliable extract pairs a clean initial full pull with timestamped backups and an incremental delta run right before Monday launch. In an earlier migration for a manufacturer rep agency with roughly 28,000 opportunities, separating the initial load from a cutover-weekend delta sync captured 207 updated opportunities, 273 emails, and 214 attachments without locking reps out of Salesforce during the build.

Follow this four-step sequence before loading records into Odoo:

  1. Assign Query All Files and read-only OAuth access: Create or authorise a dedicated integration user via Salesforce’s own OAuth consent screen with read access to Account, Contact, Opportunity, Task, Event, EmailMessage, Attachment, ContentDocument, ContentVersion, and ContentDocumentLink. Never share admin passwords.
  2. Use Export All for historical and soft-deleted records: Standard API queries skip soft-deleted records sitting in the Recycle Bin or archived activities. Running queryAll() (or Data Loader’s Export All with Bulk API unchecked) ensures closed opportunity history and field history up to the 24-month retention limit come across intact.
  3. Preserve Salesforce IDs as Odoo External IDs: Per Odoo 19’s export and import documentation (checked Nov 2026), mapping each source record’s 18-character Salesforce ID into Odoo’s External ID (ID) column lets you re-run trial loads and cutover delta syncs repeatedly without creating duplicate companies or deals.
  4. Reconcile counts and sample binaries before cleanup: Before running CRM data cleanup, verify that exported CSV row counts match Salesforce report totals and open at least 10 random extracted quote PDFs from disk to confirm zero zero-byte or truncated files.

Mapping exported emails and attachments into Odoo chatter

Once your Salesforce tables and ContentVersion binaries sit cleanly in staging, loading them into Odoo requires linking each message and file to the matching migrated record rather than dumping files into a shared folder. In Odoo 19, emails map to mail.message (with sender, timestamp, subject, and body rendered chronologically in the opportunity’s chatter), completed Task logs map to chatter notes or completed mail.activity records, and binary files load into ir.attachment with res_model = 'crm.lead' and res_id pointing to the migrated opportunity’s database ID resolved via External ID.

Salesforce source Target Odoo model Key linking field
EmailMessage mail.message RelatedToId matched to Odoo External ID
Task (calls, logged emails) mail.activity or mail.message WhatId / WhoId matched to Opportunity or Contact
Attachment (Body + Name) ir.attachment ParentId resolved to crm.lead or mail.message
ContentVersion (VersionData) ir.attachment Joined via ContentDocumentLink.LinkedEntityId

Keeping the original file extension and filename (Title + FileExtension from ContentVersion) ensures reps can preview quote PDFs and spreadsheets directly inside Odoo chatter on Monday morning. As documented in Odoo 19’s email communication guide (checked Nov 2026), incoming and outgoing emails plus internal notes sit together in that same chatter panel on each opportunity.

What Salesforce Weekly Export leaves out (and how to capture Notes)

Setup Data Export captures standard object CSVs, EmailMessage tables, and binary attachments when you tick the file checkboxes, but it omits runnable Salesforce configuration and requires extra mapping for Lightning Enhanced Notes. Understanding those gaps prevents surprise omissions when reconciling what moves and what is rebuilt in Odoo.

Data type Included in Setup Data Export? Where it sits and how to handle it
Legacy Note records Yes (Note.csv) Linked straight to parent records via ParentId; maps to Odoo chatter notes
Lightning Enhanced Notes (ContentNote) Yes, if Salesforce Files checkbox is ticked Stored inside ContentVersion (FileType = 'SNOTE') and joined via ContentDocumentLink.LinkedEntityId
Inline images inside rich-text fields or emails Partly (referenced by URL) Must be fetched over authenticated sessions before Salesforce access ends, or images break
Flows, validation rules, and report layouts No (metadata, not record data) Inventoried separately via Metadata API and rebuilt as Odoo automation rules or dashboards

Edition rules also matter before you pick an extraction method. Salesforce Professional Edition restricts API access by default unless enabled as an add-on, so Professional orgs without API access often start from Setup Data Export (limited to 29-day intervals) rather than running Data Loader or an OAuth puller.

How to handle OAuth permissions, sandboxes, and staging data security

You never need to hand over a Salesforce administrator password to extract your database, and you should extract from production rather than a partial sandbox when testing attachment loads. Partial Copy and Developer sandboxes frequently exclude full ContentVersion file binaries and historical EmailMessage logs, which hides attachment edge cases until cutover weekend.

To extract cleanly without risking credentials, follow three operational rules:

  1. Connect through Salesforce’s OAuth screen: During guided onboarding, your Salesforce admin signs in directly on Salesforce’s own OAuth consent screen to grant read-only access to the objects in scope—with zero passwords shared or stored, and token access revocable in Salesforce Setup at any moment.
  2. Keep timestamped backups before any cleanup: Every extracted object CSV is archived before picklists, duplicates, or stale deals are normalized, and staging extracts are deleted after launch in line with our data handling and export policy.
  3. Verify future Odoo portability before launch: Leaving Salesforce should never trap you in another closed box. Odoo lets teams export any list view to CSV or Excel, and on Community databases where large native exports can time out (Odoo 19 export documentation, checked Nov 2026), our background export wizard prevents browser timeouts when pulling thousands of historical rows.

If your org sits near a contract expiration, check our Salesforce exit checklist and cutover weekend run sheet, or run the Salesforce Exit Readiness Scorecard to see whether your attachment and object volume fits Launch, Standard, or Scale scope.

Frequently asked questions

Does Salesforce Weekly Data Export include email bodies and file attachments?

Yes, if you select the option to include images, documents, and attachments when scheduling the export in Setup. Salesforce packages standard object CSVs alongside folders containing Attachment and ContentVersion binaries. However, you still have to match file IDs back to parent opportunities and EmailMessage records using ContentDocumentLink CSVs before importing into Odoo.

Why are some attachments missing when we export ContentVersion through Data Loader?

Data Loader only returns files owned by or explicitly shared with the logged-in user unless an administrator enables the Query All Files administrative permission on that user's profile or permission set. Without Query All Files, private reps' quote PDFs and email attachments stay hidden from the extract even though they remain visible inside Salesforce.

Can Bulk API 2.0 export binary attachment files directly?

No. Salesforce Bulk API 2.0 is designed for tabular CSV record queries and ingest operations above 2,000 records, not bulk binary file downloads. To extract actual PDFs, spreadsheets, and email attachments cleanly, migration scripts query ContentVersion metadata via SOQL and fetch each VersionData binary payload over the REST API.

What happens if we miss the 48-hour download window in Setup Data Export?

Salesforce permanently removes generated backup zip files 48 hours after sending the completion email, and starting a new manual export immediately overwrites any prior waiting files. On Enterprise editions you must wait up to 7 days—or 29 days on Professional edition—before Setup allows another scheduled export.

How do we avoid missing new emails and attachments created during a multi-week migration?

You separate the initial full extract from a cutover delta sync. Your team keeps working inside Salesforce during trial loads, and on cutover weekend an API puller filters by SystemModstamp or CreatedDate to capture only new and updated opportunities, emails, and attachments since the prior snapshot.

Do Salesforce Enhanced Notes export in Setup Data Export?

Yes, when you tick the checkbox to include Salesforce Files and CRM Content document versions in Setup Data Export. Lightning Enhanced Notes (ContentNote) are stored as ContentVersion records with FileType set to SNOTE and link back to parent opportunities or accounts through ContentDocumentLink rather than a simple ParentId column.

Sources

  1. Salesforce Help: Export Backup Data from Salesforce (checked )
  2. Salesforce Help: Export Files Using Data Loader (checked )
  3. Salesforce Main Services Agreement (Oct 15, 2026) (checked )
  4. Odoo 19.0 Export and Import Data Documentation (checked )
  5. Odoo 19.0 Communication in Odoo by Email Documentation (checked )