3

The Content Id in the URL is a ContentBody, which states: Cannot be queried, inserted, updated, or deleted directly. ... ContentBody is intended for internal Salesforce use. If you need to access the file content body, please use ContentVersion. In other words, you're not meant to use this Id. If you need to generate a public link, create a ...


3

Salesforce CLI has limited support for the file unless you use a custom script it. Looks like community has a solution, Install the shane-sfdx-plugins using sfdx plugins:install shane-sfdx-plugins Once installed I would explore the below commands sfdx shane:data:file:download -i <filed> And upload using sfdx shane:data:file:upload -f <filepath> -...


3

If you're using Files, you are using Salesforce Content. In fact, when you add a Chatter File, the platform is generating a ContentDocument/ContentVersion/ContentDocumentLink just as if you were using those objects directly - in addition to the Chatter post(s). The model sounds complicated, but it can be relatively simple to use the REST API to insert a File....


2

Yes, the List object is an ordered list. Therefore, the relationship between your case and the PDF is 1:1. You'll never get a situation where the order changes arbitrarily. If you had an "optional" update, then you'd want to use a map: Map<Id, Blob> pdfs = new Map<Id, Blob>(); for(Case record: cases) { if(shouldDoPdf(record)) { ...


2

One way to achieve this would be to examine the field metadata on all sObject types that you can access. You are looking for any field that has the base64 data type. That would have a capacity to store file date (in theory at least). This is true for: ContentVersion.VersionData StaticResource.Body Document.Body Attachment.Body I also found: EmailCapture....


2

VersionData is a Blob, whether it can be converted to a string depends on the type of file. If it is a text file you can use Blob.toString(). If it is a binary file you can use functions from EncodingUtil to get the contents as a base64 of hex encoded string, provided the encoded data is no more than the maximum string size in apex (6000000 bytes).


2

ContentDocument may be linked with several cases at ones with contentDocumentLink. Imagine you have ContentDocument1 related to Case1 and Case2. You're iterating through Cases, you are on Case1, adding ContentDocument1 to listToDelete, deleting it. Then going to Case2, getting ContentDocument1 again, but it is already deleted in previous loop-iteration. The ...


2

There is a limit of 6MB for the request body that can be sent via the apex outbound. Note that for multipart messages you are hitting this limit of around 2MB since the size after you creating your own string via custom code is exceeding 6MB. As it involves base64 encode and this adds additional overhead. For this type of integration, I suggest using a ...


1

Here is an example you could use for supporting ContentDocuments with FileType TEXT. Storing each ContentDocument and their respective VersionData as a String across a Map. List<String> fileTypes = new List<String>{'TEXT'}; List<ContentVersion> contentVersions = [ SELECT VersionData,ContentBodyId,ContentDocumentId FROM ...


1

You can use ContentFolderMember to get child contentdocuments and from content documents you can get contentversion Ids. ContentWorkspaceDoc will help you to filter contentdocuments based on library. You can assign contnetverion Ids in an array with setEntityAttachments to SingleEmailMessage //get document Ids from your library List<ContentWorkspaceDoc>...


1

Unfortunately, I don't think, that you will be able easily to read and edit a word file (.docx my assumption) by means of the native apex. It definitely contains some workarounds. The reason for that is .docx is not just a plain text file, actually, it is an archive file with folders, subfolders, and mainly .xml files. Just try to open .docx file by means ...


1

The binary data must be in its raw form. --boundary_string Content-Type: application/pdf Content-Disposition: form-data; name="VersionData"; filename="10840.pdf" %PDF-rest of binary data here, with no line breaks, etc. It should be mostly illegible... --boundry_string-- You may also want to read RFC 7578. Edit: See this gist for an ...


1

So it turns out Base_Station__c is a lookup, and you are trying to push a String value = csvRowData[0] which is just a string, thus it fails. You need to query the data first and fetch the ID for the field and populate the ID there.


1

Two things to consider, sharing of files and permissions. When a file is uploaded to a record, for sharing, the following occurs: The owner has the "Owner" share type Users who can see the record can see the file There's a setting called Set file access to Set by Record for files attached to records. that will allow users who can edit the record ...


1

In your test class you should set the current page via Test.setCurrentPage(page) method. Then you can add to the page the id of the record you're using in your test. Replace DokuBox_6 D6 = new DokuBox_6(); with: PageReference dokuboxPage = Page.DokuBoxPage; // Assuming that the VF Page name is DokuBoxPage Test.setCurrentPage(dokuboxPage); ApexPages....


1

Found the answers. Is it because the Content Document has only one Content Version? We cannot delete a content version but only the content document. The number of Content Versions does not matter. How can I create a new Content Version for the same Content Document? Is by apex (querying for a Contend Document and adding a Content Version) the only way I ...


1

Salesforce does not guarantee all file types and their contained features will properly generate previews in Content. Please refer this doc detailing the limitations of Content file previews. Limitation around PDF files Large numbers of pages. Exact number is dependent on their content but if the count is high (100+) it may cause the preview generation ...


1

Not in Apex. You'd be limited by the heap size of Apex. You would need an external service to read the file, instead. For example, you could write a Heroku service to call the Salesforce REST API, then do the chunking/sending on the Heroku side.


1

u have first to enable external sharing on the file level:


1

You have multiple types of error there. DUPLICATE_VALUE is an error on inserting a Hierarchy Custom Setting that already exists. INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY is an error that can be generated by a myriad of different issues. In this case, my first guess is that the running user does not have access to the record to which you are seeking to ...


1

Okay I figured it out, I was using a SingleEmailMessage object, and according to this documentation I have to add an attachment using the following code: email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); instead of doing Mail. attachment This worked!


1

Although ContentDistribution.ContentDocumentId references a ContentDocument, there is no relationshipName to traverse. You can see this via Workbench, contrasting ContentDocumentId versus ContentVersionId. Since ContentVersion's parent is ContentDocument, you can get ContentDocument fields as as a grandparent of ContentDistribution follows: SELECT Id,Name,...


1

Finally, I figured out the issue. Go to app launcher ==> Search for "Files" Go to Library ==> Select the folder you uploaded files Click on "Manage Members" button Select the user you logged-in and select the Access Lastly, make sure the access has "Deliver Content" How to get the Library Permission: Setup ==> Library ...


Only top voted, non community-wiki answers of a minimum length are eligible