cancel
Showing results for 
Search instead for 
Did you mean: 

how to count user related site's documents in alfresco

janaka1984
Star Contributor
Star Contributor

Hi,

i need to count user related site's documents.

i have used following url . but it return count of all documents.

http://127.0.0.1:8080/share/proxy/alfresco/slingshot/doclib/doclist/documents/node/alfresco/sites/ho... 

Regards

janaka

1 ACCEPTED ANSWER

janaka1984
Star Contributor
Star Contributor

i have used my own service with search.luceneSearch() to get documents from multiple sites.  To get user related sites, i have used following existing  service

var currentUser = person.properties.userName;    
 var sites = siteService.listUserSites(currentUser, 0);

after read this sites, i could create PATH and send it to search.luceneSearch() 

View answer in original post

4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator

Can you please explan what you consider to be "user related site documents"? Are these all documents that the specific user "owns", has created and/or modified or which are somehow "tagged" for the user?

The URL you have used refers to an internal API / operation which may change between Alfresco versions. Please be aware that it is not recommended to use these kinds of APIs for integration with other applications. That is what CMIS or the public ReST API are for.

I have five sites ("ABC", "XYZ".......) which contains documents , then user  ("omega") is assigned  into two of those sites.

 when i am logging to USER ('omega") dashboard, i  need to show total count of documents which is stored in above two sites, and need to show meta data of rendered document.

kaynezhang
World-Class Innovator
World-Class Innovator

As far as I know there is no such api directly.
The best way is to customize your own webscript api ,you can implement your requirement by combining site servcie and StatsService .
Another option is try to use doclist data webscript to get all documents of all sites that a user have permissions ,like this
http://localhost:8080/alfresco/s/slingshot/doclib/doclist/documents/node/alfresco/sites/home?limitRe...
and use totalRecords property. but it has poor performance and by default the max number can't be greater than 1000.

janaka1984
Star Contributor
Star Contributor

i have used my own service with search.luceneSearch() to get documents from multiple sites.  To get user related sites, i have used following existing  service

var currentUser = person.properties.userName;    
 var sites = siteService.listUserSites(currentUser, 0);

after read this sites, i could create PATH and send it to search.luceneSearch()