0

In a document library folder, when a user creates a new document, instead of it being named 'Document' when created, I want it to be named as the last name of the user. I have explored trying to do this through a Flow but there does not seem to be a way to rename a document. The user cannot rename the document themselves as they do not have delete permission.

enter image description here

2 Answers 2

0

Mike's link is very helpful. Do have a check on it. I made a sample flow works in my end. enter image description here

The"Test Library" is your library name.

The SP.Data part in the body needs to be checked via the following link

https://yourdomain.sharepoint.com/sites/yoursitehere_api/web/lists/GetByTitle('Library name')?$select=ListItemEntityTypeFullName

enter image description here

The last outputs part is your required file name format.

enter image description here enter image description here

10
  • The Flow fails with an error 'BadGateway' "message": "The file or folder name contains characters that are not permitted. Please use a different name." Not really sure what I did wrong. Any ideas?
    – cflasrado
    Oct 17, 2019 at 14:21
  • @cflasrado would you like to show us your setting in the send an HTTP request action?
    – Jerry_MSFT
    Oct 21, 2019 at 1:52
  • I updated my question with the image.
    – cflasrado
    Oct 21, 2019 at 14:27
  • Ok, I managed to get it to work. However, the flow fails with the error the document is checked out to me. Is there a way to delay the flow until the document has been saved or checked back in?
    – cflasrado
    Oct 21, 2019 at 19:11
  • @cflasrado change the trigger to when a file is created or modified. Then you can add a if condition on the " check out" property which will indicate the status of the file. Only send the http request when check out is false. I updated with a pic
    – Jerry_MSFT
    Oct 22, 2019 at 1:30
0

This is a 2013 style workflow:

enter image description here

enter image description here

enter image description here

This simple demo grabs the full name, but you could use Find Substring in String and one of the Extract Substring actions to pull off the last name.

You will need to configure App permissions to let the workflow do what the user is not allowed to do. (rename)

4
  • Would this Flow work/be applicable on SharePoint Online because I do not see an action available to Set Name? I only see an action to Update Item or File.
    – cflasrado
    Oct 16, 2019 at 20:04
  • The action is called "Set field in current item". The field being set is "Name". Oct 16, 2019 at 20:07
  • I am using Flow and not SharePoint Designer and that action is not available on Flow. Is there a way to achieve what I am trying by using Flow?
    – cflasrado
    Oct 16, 2019 at 20:40
  • Ah. Your question said workflow and was tagged workflow. Flow can call the SharePoint web services. This might apply: powerusers.microsoft.com/t5/Building-Flows/… Oct 16, 2019 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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