cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
przlwo
Level: Powered On

create clickable link in a sharepoint document library

Hello,

 

I need to create in one sharepoint library a clickable link (shortcut) of a document that is just created in other library (link autocreation for new documents in the "other library")

 

I'm trying to do it in this way:

 

Capture.PNG

 

But getting below error message (under "OUTPUTS" section):

 

{
"status": 400,
"message": "To add an item to a document library, use SPFileCollection.Add()\r\nclientRequestId: 7a2f0e11-34c9-458e-bcbe-d829fd897cd1\r\nserviceRequestId: 7045b49e-209b-7000-6874-8dbe10f7d220"
}
 
I assume I cannot use "Create Item" action for sharepoint library, so how can I build this functionality?

Accepted Solutions
Highlighted
przlwo
Level: Powered On

Re: create clickable link in a sharepoint document library

Hi, good news for everyone that needs this functionality. I found the way how to do it.

1. Create a link to a document in a library (that has "Link to document" content type assigned)

2. Check if the newly created link works as expected.

3. Download the link file (aspx)

4. Create workflow as below (paste the aspx file content to "File content" field. All that needs to be changed in the content file is the document url (two times) - as shown on the below screen.

 

And that's it Smiley Happy

 

Capture.PNG


All Replies
Super User Rank
Super User

Re: create clickable link in a sharepoint document library

@przlwo:

 

If I understand you correctly, you want to create a link to a document.  If so, you don't want to use a library.  Rather you want to use a list and Create Item.  Include a hyperlink coumn in the list.

 

MakeLink.jpg

If this addresses your issue, please mark you post as Solved.

 

Scott

 

 

przlwo
Level: Powered On

Re: create clickable link in a sharepoint document library

Hi Scott,

 

This is not exactly what I want to achieve. When I apply your suggestion, in the URL column (Hyperlink or Picture) I can see link to the document - which is ok - but when I click on this link, I can only open the file in client version or MS Word.

I'd like to achieve same efect what you can see when you add new document to a sharepoint library with use of "Link to a Document" content type. There are two properties - Document Name and Document URL, after I add link in this way, I can see in "Title" column the document name and when click on the name, the document is opening in browser.

 

I hope you understand and are able to reproduce what I explained.

 

Thanks

 

 

Super User Rank
Super User

Re: create clickable link in a sharepoint document library

@przlwo:

 

If you append ?web=1 to the URL of an Office document in SharePoint, it will open in the web app.  That said, it isn't working the way I expected.....

 

I will test and respond later tonight with how to open in the web app as well as adding the link description.

 

Scott

przlwo
Level: Powered On

Re: create clickable link in a sharepoint document library

This works for opening document in browser, however I still need one more thing: how to put the updated URL under a document title (just to be able to click on the document name/title and then the document is opening in browser)?

Something like on below screen where in a document library I created a link (by "Link to a Document" content type) and no when I click on "Test", the document is opening in browser.

 

Is it possible to achieve this by workflow created in MS Flow?

bonm014
Level: Powered On

Re: create clickable link in a sharepoint document library

Unfortunately it is impossible to create. You have to upload a link to a document ASPX file (download the file when you create one manually) and then assign the property.

BUT this will not result in a valid link to a document... I tried... Even the Add-PNPFile commandlet does not work correctly to create a valid link to a document item within a document library

Highlighted
przlwo
Level: Powered On

Re: create clickable link in a sharepoint document library

Hi, good news for everyone that needs this functionality. I found the way how to do it.

1. Create a link to a document in a library (that has "Link to document" content type assigned)

2. Check if the newly created link works as expected.

3. Download the link file (aspx)

4. Create workflow as below (paste the aspx file content to "File content" field. All that needs to be changed in the content file is the document url (two times) - as shown on the below screen.

 

And that's it Smiley Happy

 

Capture.PNG

>