Changing the file size limit for a community
By default, an HCL Connections community can contain 500 MB of files in the Files widget. Depending on what kind of content is posted in the community, that might not be enough. It’s possible to change the file limit, both for communities and for personal files.
Files Administration
All commands in this article are executed in the wsadmin console and need the functions in the FilesAdmin.py, so the first step is to open this console:
cd /<WAS-PATH>/profiles/dmgr/bin
./wsadmin.sh -lang jython
execfile("filesAdmin.py")
File Policies
The amount of data that you’re allowed to store in your community or in your personal files is defined by a file policy. You can find the several FilePolicy commands here.
If you want to see how many file policies you have in your environment, you can use this command:
FilesPolicyService.getCount()
To see what the size if for each policy, you can use this command:
FilesPolicyService.browse(string sortOption, string sortAscending, int pageNumber, int itemsPerPage)
For example:
wsadmin>FilesPolicyService.getCount()
7
wsadmin>FilesPolicyService.browse("title", "true", 1, 25)
[{maximumSize=524288000, id=00000000-0000-0000-0000-000000000005, title=!Default for Application}, {maximumSize=524288000, id=00000000-0000-0000-0000-000000000001, title=!Default for Community Files}, {maximumSize=524288000, id=00000000-0000-0000-0000-000000000003, title=!Default for Community Wikis}, {maximumSize=20971520, id=00000000-0000-0000-0000-000000000004, title=!Default for Guest Users}, {maximumSize=524288000, id=00000000-0000-0000-0000-000000000002, title=!Default for Non-Community Wikis}, {maximumSize=524288000, id=00000000-0000-0000-0000-000000000000, title=!Default for Personal Files}, {maximumSize=2147483648, id=4c4585db-b931-4ea7-af69-63e70f509e78, title=2 GB Policy}]
So in this environment, there is one custom policy, which sets the size to 2 GB for certain communities or personal files. You can add an extra policy, using:
FilesPolicyService.add(string title, long maximumSize)
where maximumSize is the size in bytes. It is defined as: maximumSize : A number representing the maximum size allowed, in bytes, for libraries that the default policy is assigned to. Numbers 2GB or greater are long literals, and you must add an “L” to the end of the number, for example a policy of 2GB must be `2147483648L`.
If you want to raise the 500 MB limit for all personal libraries, you can use this command:
FilesPolicyService.editPersonalDefault(long maximumSize)
For the default size of communities, the command is:
FilesPolicyService.editCommunityDefault(long maximumSize)
example:
wsadmin>FilesPolicyService.editCommunityDefault(786432000L)
The policy with the id 00000000-0000-0000-0000-000000000001 was updated successfully.
Sets the default file size for all communities to 750 MB.
Setting a new files size limit on a specific community
To set a size limit on one community in particular, you need to know the files library id of that community. We can find that ID through the community id. You can grab the community id from the url if you go to the community: This will give a list, where the “id” is the id that you need. Example: Check here for the commands to do the same for personal libraries. To set the 2 GB policy on this library, do: For example: If you don’t have access to the community that you need to change the policy of, you can find the ID of the community through the communitiesAdmin script (thanks to Martin Vogel for this tip):FilesLibraryService.getByExternalContainerId(string community_id)
wsadmin>FilesLibraryService.getByExternalContainerId("e63b1071-8e11-48c5-b978-3a5b4241f19b")
{summary=verzamelplek en overleg voor inhoud en strategie., percentUsed=99.92403392791748, label=W7e33bb8e99fe_4f75_9980_9f32e0d05b7d, type=community, title=werkgroep Communicatie, themeName=default, externalInstanceId=W7e33bb8e99fe_4f75_9980_9f32e0d05b7d, externalContainerId=e63b1071-8e11-48c5-b978-3a5b4241f19b, size=523889719, policyId=00000000-0000-0000-0000-000000000001, lastUpdate=Sun Oct 27 08:40:23 CET 2024, ownerUserId=00000000-0000-0000-0000-000000000000, maximumSize=524288000, id=828539ff-0850-47bc-bfe4-bf6e21569718, createDate=Wed Nov 04 20:38:42 CET 2020}FilesLibraryService.assignPolicy(string libraryId, string policyId)
wsadmin>FilesLibraryService.assignPolicy("828539ff-0850-47bc-bfe4-bf6e21569718","4c4585db-b931-4ea7-af69-63e70f509e78")
The policy with the id 4c4585db-b931-4ea7-af69-63e70f509e78 is now assigned to the library with the id 828539ff-0850-47bc-bfe4-bf6e21569718
execfile("communitiesAdmin.py")
allComm=CommunitiesService.fetchAllComm()
CommunitiesListService.filterListByName(allComm,"werkgroep Communicatie")
e63b1071-8e11-48c5-b978-3a5b4241f19b