0

A document has been created by flow in SharePoint Online and 'Created By' is the set to the flow Owner. Unfortunately, the flow action does not allow me to set the 'Created By' to a specific user. Approval's are enabled, creating minor version.

The issue is that the person who uploaded the file (via Power App > Flow) is not the 'Created By' of the document and as a result cannot see the document as it's a minor version.

If I adjust the permissions to Design then the user has access to the minor version. However when submitted for approval, Design permissions need to remain which means the user can approve his/her own document. Is there a way to either:

  1. Create a file in Flow which sets the Created By user who submitted file or
  2. Allow this specific user to see this draft file only?
1
  • I am checking to see how things are going there on this issue. Apr 6, 2023 at 6:04

1 Answer 1

0

You can set Created By column value to respective user using Power automate flow.

Follow the steps:

  1. Pass email address of current user to Power automate flow

  2. Get loginName (user principal name) of user from Office 365 users connector OR generate the loginName using email in format like:

    i:0#.f|membership|[email protected]
    
  3. Then use flow like below:

    enter image description here

Flow action configurations:

Compose User:

[
  {
    "Key": "i:0#.f|membership|[email protected]"
  }
]

2nd Compose - formValues:

[
  {
    "FieldName": "Author",
    "FieldValue": "@{outputs('Compose_User')}"
  }
]

Send an HTTP request to SharePoint:

Method: POST

Uri:

_api/web/lists/getbytitle('ViewThreshold')/items(1)/validateUpdateListItem

Use list name and item ID as per your SharePoint site.

Body:

{
   "formValues": @{outputs('2nd Compose - formValues')},
   "bNewDocumentUpdate": true
}
9
  • I'm sure I tried this and it wouldn't work. Reading further, I found it only works for Lists. Have you tried it for a library? Mar 9, 2023 at 12:32
  • I haven't tried with a library yet. You are running flow via Power Apps, right? Ideally when you run flow via Power apps, it runs with the context of current user in app - so why file is not created using app user instead of flow owner? which actions and connections are you using to create file. Mar 9, 2023 at 13:00
  • PowerApps runs under user context. The Flow is of of Instant type and I'm using a PowerApps trigger in the flow. Mar 9, 2023 at 14:40
  • Which actions are you using to create file? If flow is running in context of user and same flow is creating a file, ideally Created By should user who is running flow from app. Mar 9, 2023 at 14:44
  • Using 'Create File' action. I believe the flow runs under the owner account. This is because of the PowerApp's trigger thats being used in the flow. Mar 9, 2023 at 14:59

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.