A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

10 Replies
Highlighted
Alfresco Employee

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

Hi you may want give a look to the official JS-API documentation alfresco-js-api/SharedlinksApi.md at 728cbf5a4da1a57f4e9edaffe4b0efa5983c361d · Alfresco/alfresco-js... 

Highlighted
Member II

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

Hi Eugenio,

The code there is for the API

var sharedId = "sharedId_example"; // The identifier of a shared link to a file.

this.alfrescoJsApi.core.sharedlinksApi.deleteSharedLink(sharedId).then(function() {

console.log('API called successfully.');

}, function(error) {

console.error(error);

});

I am trying to figure out if the sharedID is a document property, aspect, attribute, or ?? Then I would like to write a Javascript that would remove it. From what I understand about the code above, I would already have to know the sharedID and then execute this using the API.

Tom

Highlighted
Alfresco Employee

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

yep you should know the ID in order to delete it

Highlighted
Member II

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

Yep, I need to know the shareID in order to delete it. That means I have to be able to write a Javascript that can get the ID when the document enters the folder. But I do not know if the ID is a property, category, tag, aspect or something else.

Any ideas?

Highlighted
Alfresco Employee

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

Are we still talking about ADF or Share with Folder rules?

Highlighted
Member II

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

My company uses nCommandShare for contracts and other documents. They are mostly in PDF format. When a customer signs a contract, we have them login and upload the document to their “send” folder. A Rule is then run to move the document to another folder where we retrieve it.

My issue is that they can then go to their dashboard and click on a link that allows them to access the document in the folder to which it was moved even if they cannot access that folder directly. Once they have accessed their document in the folder, they can access other documents in the same folder. So, we had to setup the system so that each user has a separate folder that only contains their documents.

I would like to use a single folder to collect all of the documents as that is much easier to check. I discovered that if a user uploads a document and I go to the folder containing the document and “Ushare” it, that removes the link to the document on their dashboard. In other words, they can no longer find the document using a link. As near as I can tell, they can no longer access the document at all.

I would like to write a Javascript that “Unshares” the document when it is moved to the new folder after the user uploads it. To do that, I need to know how to find the shareID of the document. I can find it in the program interface but I have no idea if the shareID is a document property, tag, category, aspect… or what. I cannot figure out how to use Javascript to capture the shareID when a document is moved into a folder. Then I want to use the same script to delete the shareID from the document.

Thank you,

Tom

Highlighted
Alfresco Employee

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

It is still unclear. Are you talking about ADF framework (Angular components) or some Share customisations? From what I see your questions are absolutely not related to ADF, at least there's nothing in your question about ADF.

Highlighted
Member II

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

Hi,

I am not a really great developer. I have written several short Javascripts for our use but nothing major. The screenshot below shows how I learned about “Unshare”. I do not know if this is about ADF, customizations, or something else entirely.

Document is in a folder. There is a control under the document labelled “Shared”. Click on it and you find the “Public Link” and “View” and “Unshare” controls. I execute the “Unshare” control which seems to remove (or disable?) the shareID. I am trying to do this automatically using a Rule and Javascript when the document enters the folder.

Highlighted
Active Member II

Re: A document can be unshared by clicking on the Shared link and then clicking Unshare. Can this be done using Javascript so that the document is automatically unshared when it is placed in the folder?

When a "quick share" is created on a file then the aspect qshare:shared is added to the node, try creating a folder rule that removes the aspect when files move into the folder.

You can view what aspects are on a file via the node browser in the Share admin tools.