Copy To SharePoint - Result (On Prem)

  • 6 January 2016
  • 3 replies
  • 2 views

Badge +6

Hi,

I currently use the Copy To SharePoint action to copy a document from one library to another. The result of the document copy is provided as a URL.

I then need to update that new list item with additional data. In order to do so, I am trying to use the where clause with the result that was returned. I have queried against the Encoded Absolute URL, the Server Relative URL (after doing string manipulation) but I am not having any success.

Is there a best practice for determining the new item created so that you can update metadata after it is created?


3 replies

Badge +3

Hi Jason Durrant

Copy to SharePoint action returns a full url, not encoded : http://www.contoso.com/sites/library/hello world.docx

item properties Relative Url returns relative url, not encoded : /sites/library/hello world.docx

So, use a build string to replace the site name (url beginning) by nothing in your variable and use this value to update item

Badge +6

Hi,

This is what I tried initially but it failed when the document had a space in the name. That is why I attempted to encode it. So, to clarify:

  1. Get result from Copy to SharePoint - url (not encoded)
  2. Use build string to change result into a server relative url
  3. Use the result as a where clause for the Update item against the Server Relative URL of the destination list

This does not work.

Any ideas?

Userlevel 5
Badge +9

Hi,

You can execute the following web request to get the file ID from its server relative url :

http://your_sharepoint_site/_api/web/getfilebyserverrelativeurl('your_file_server_relative_url')/ListItemAllFields/ID

Hope this helps

Reply