1

ContentWorkspaceDoc

SELECT COUNT(ContentWorkspaceId) FROM ContentWorkspaceDoc group by ContentWorkspaceId

Error: "Grouped field should be aggregated: ContentWorkspaceId"

Is there any efficient way to check the count of documents in each library without querying for their counts individually?

As there are limits: 2000 libraries, or 50,000 documents per library one would assume it'd be possible to check these to maintain a large cache of documents!

Additionally is it possible to create new ContentWorkspace records from APEX?

insert new ContentWorkspace(Name='Whatever');

Field is not writeable: ContentWorkspace.Name

1
  • 1
    "is it possible to create new ContentWorkspace records from APEX?" - nope - they can't be mocked with apex dml – cropredy Jan 8 '16 at 21:03
2

Question 1:

Your query should read:

SELECT contentworkspace.name, COUNT(ID) FROM ContentWorkspaceDoc group by contentworkspace.name

When I ran it in my environment, I get counts of ContentWorkspaceDocs per library

Question 2 is it possible to create new ContentWorkspace records from APEX?

Nope - they can't be mocked in testmethods either with apex dml. Even worse, they can't be created in the API as per the Sobject doc on ContentWorkspace

2

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.