I have to push about 40,000 files into Salesforce as case files for a go live cutover.

I have a process which creates a ContentVersion and then a ContentDocumentLink.

In one sandbox, the files are created fine and the visibility is as desired. In the other, using the same exact code, the "InternalUsers" setting is simply ignored and it keeps ending up as "AllUsers" - which makes the sensitive, internal only documents attached to cases visible to the customer portal. Not acceptable, obviously.

This is the core code:

ContentVersion newDoc = SetContentVersion(ae, atchConn);

SuccessResponse response = await _client.CreateAsync("ContentVersion", newDoc);
// Look up the document id created 
ContentVersionBare document = await _client.QueryByIdAsync<ContentVersionBare>("ContentVersion", response.Id);

ContentDocumentLink link = new ContentDocumentLink
    ContentDocumentId = document.ContentDocumentId,
    LinkedEntityId = sfCase.Id,
    Visibility = ae.CustomerVisible ? "AllUsers" : "InternalUsers",
    ShareType = "V"

response = await _client.CreateAsync("ContentDocumentLink", link);

But all the files end up as AllUsers - and when I use a utility like XL-Connector to set the Visibility, "InternalUsers" isn't available.

What settings can get in the way here? Where should we be looking?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.