People, people, ... hold your whoreses (yes, pun)!
It's much easier than that!
Pre-steps:
1. Know the ID of the library you want to move stuff to (to know this, go to the library and copy the id from the url, or do an export on 'ContentWorkspace' and select Name & Id)
Operation:
1.
- Open dataloader and choose Export
- object 'ContentDocument'
- select Id, Title & ParentId
- open in spreadsheet
- find all documents you want to be moving (by filtering, sorting ...) and replace the 'ParentId' with the Id of the destination
library
- make a csv out of it
- dataloader --> update, choose ContentDocument, choose the csv you just made
- Play Kool & the gang, and dance the rest of the day (you were otherwise spending moving stuff manually or fixing errors)
Hurray stackexchange! :)
Let's say you upload a file under any record or chatter, the file reference is retrieved from ContentDocument
object. ContentDocument
represents the library in Salesforce CRM Content or Salesforce Files.
Based on the ContentDocumentId, you can retrieve the ShareType and LinkedEntityId from ContentDocumentLink
object.
SELECT Id, ShareType, LinkedEntityId, Visibility
FROM ContentDocumentLink
WHERE ContentDocumentId = '069q00000001jv0'
Here LinkedEntityId
will return list of users.
ShareType
Description
Required. The permission granted to the user of the shared file in a library. This is determined by the permission the user already has in the library. This field is available in API version 25.0 and later.
V
Viewer premission. The user can explicitly view but not edit the shared file.
C
Collaborator permission. The user can explicitly view and edit the shared file.
I
Inferred permission. The user’s permission is determined by the related record. For shares with a library, this is defined by the permissions the user has in that library.
LinkedEntityId
ID of the linked object. Can include Chatter users, groups, records (any that support Chatter feed tracking including custom objects), and Salesforce CRM Content libraries.
Visibility
Specifies whether this file is available to all users, internal users, or shared users. This field is available in API version 26.0 and later.
Visibility can have the following values.
AllUsers—The file is available to all users who have permission to see the file.
InternalUsers—The file is available only to internal users who have permission to see the file.
SharedUsers—The file is available to all users who can see the feed to which the file is posted. SharedUsers is used only for files shared with users, and is available only when an org has private org-wide sharing on by default. The SharedUsers value is available in API version 32.0 and later.
For more information, refer ContentDocumentLink
Update based on comments
List<ContentDocumentLink> lstlink = [SELECT Id, ShareType, Visibility, LinkedEntityId FROM ContentDocumentLink
WHERE ContentDocumentId = '069q00000001jv0'];
for(ContentDocumentLink cl:lstlink)
{
Id objId = cl.LinkedEntityId;
System.debug(objId + 'Object Name=' + objId.getSObjectType().getDescribe().getName());
}
In the debug log, I get userids.
Best Answer
Update: There isn't currently an object exposed with the ContentWorkspace Member details as configured against the Library.
Screenshot of the Members section from the UI:
I believe a SOQL query against ContentWorkspace will only return records that the current user has access to. However, this won't indicate the level of access.
Consider promoting the idea: workspace permissions
I would start with ContentWorkspaceDoc.IsOwner.
Description
The Data Model diagrams can be useful here.