0

I am working on a site provisioning flow and one of the requirements is to keep the URL's as short as possible.

Unfortunately, when I make a document library, I can't set the URL, only the title and the url is generated. Is it possible to change either the URL or the title with REST API for an existing document library? I know I could do this with PowerShell, but this should be a pure Flow solution.

Edit: Trying plan B, change title after creating library. This currently breaks when I add the headers to the request, I can see that the header is escaped, this is the output from Flow:

{
  "Accept": "application/json;odata=verbose",
  "IF-MATCH": "etag or \"*\"",
  "X-HTTP-Method": "MERGE",
  "Content-Type": "application/json;odata=verbose;charset=utf-8"
}

And, the request returns with error:

{
  "status": 412,
  "message": "The request ETag value 'etag or \"*\"' does not match the object's ETag value '\"1\"'.\r\nclientRequestId: 90aeb25e-2228-443e-9d6c-c54dd5d792b7\r\nserviceRequestId: a54ecf9e-e00b-0000-58f3-2e344dfe39c1",
  "source": "....../sites/FullSiteWithFlow/_api/web/lists(guid'7bfbb58a-c777-4ea6-9714-4b082049d72d')",
  "errors": [
    "-1",
    "Microsoft.SharePoint.Client.ClientServiceException"
  ]
}
  • How about making the document library with the URL that you want (initially Title and URL can be same) and afterwards change the title using REST API ? – Gautam Sheth Apr 3 at 10:01
  • Trying. Please see update in post. – vilmarci Apr 3 at 11:10
  • 1
    In the etag header use * , i.e "IF-MATCH": "*", and also ensure that you are passing correct body as body: { '__metadata': { 'type': 'SP.List' }, 'Title': 'Updated Title' } – Gautam Sheth Apr 3 at 11:15
  • Awesome, have posted this as answer :) , you can accept it which will remove this question from list of unanswered questions, thanks !! – Gautam Sheth Apr 4 at 8:56
3

The approach you need to take for this problem to use the URL value that you want as Title and then change the Title value. So, at the time of creation of doc library, simply use URL value as title and then once the list is created, you can change the list Title value using another HTTP request.

The subsequent HTTP request needs to:

1) Set etag property value in the header as "IF-MATCH": "*"

2) Ensure that you are providing the correct payload as:

body: { '__metadata': { 'type': 'SP.List' }, 'Title': 'Updated Title' }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.