cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Susmitha0706
Regular Visitor

Modified by field in Sharepoint needs to be updated with from adress used in the email

Hello,

 

I have created a flow in such a way that when new email is sent to a shared mailbox, all the attachments along with body of email as an .eml file  will be added to Sharepoint library inside a folder, which will created based on the subject of the email. Folder name will be the subject of the email which is sent. 

I was able to create it successfully but the modified by column displays my name as am the owner of the flow. But it should be someone who sends the email to the shared mailbox. Can someone kindly help me with this?

 

Note: Files are getting uploaded inside a folder and that folder is being created in the name of the subject added in email for every run.

 

Regards,

Sushmita.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Susmitha95 ,

 

I had a chance to create a working demo flow as shown below:

 

Snag_1ad916cd.png

These are the steps in my flow:

 

Snag_1ad4a8b5.png

Create a folder based on the emails Subject line:

Snag_1ad537b6.png

(You can change the Created by and Modified by properties of the folder if needed).

 

Save all attachments, 

Snag_1ad69f07.png

then change Created by and Modified by properties of the file: 

Snag_1ad7a888.png

Export the email and save to SharePoint:

Snag_1ada4bd3.png

then change the Created by and Modified by properties of the eml file:

Snag_1adb7ffd.png

This is the sample runtime output

ekarim2020_0-1662669537301.png

 

ekarim2020_1-1662669696012.png

 

Snag_1ae0380f.png

Hope this helps.

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
ekarim2020
Super User
Super User

Hi @Susmitha0706 ,

 

After the file has been saved your Sharepoint library  you can then update the Modified By column by calling an API using the Send an HTTP request to SharePoint action: 

 

You will need to use the internal name of the Modified By column in the Send an HTTP request to SharePoint action. The internal name is Editor. For more information see: How to find the internal name of a SharePoint column – Ellis Karim's Blog

 

Snag_83d9a2a.png

_api/web/lists/GetByTitle('Solution Information')/items(1)/validateUpdateListItem

{
  "formValues": [
    {
      "FieldName": "Editor",
      "FieldValue": "[{'Key':'i:0#.f|membership|AlexW@dev365.com'}]"
    }
  ],
  "bNewDocumentUpdate": true
}

 

Snag_83f544e.png

Hope this helps.


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hi Ellis,

Thank you for the response.

Susmitha0706_0-1662465590647.png

 

I tried to use the above action and ended up getting errors. My requirement is just to replace the incoming emails setting in Sharepoint onpremises.

Modified by or created by of all the files in a folder(which is being created with the title in the name of Subject of email) should be updated with name of email sender.

 

Here in my case Folder and files that include attachments and .eml file are getting created inside a folder that is being created dynamically based on our email Subject.

 

Could you check the above screenshot and kindly do help me on this.

 

Regards,

Susmitha.

ekarim2020
Super User
Super User

Hi @Susmitha0706 ,

 

The code snipped I shared above is for SharePoint Online only. What is the exact error message you are getting?

 

As I understand, your flow performs the following actions:

  1. When new email is sent to a shared mailbox
  2. A folder is created within a SharePoint Library. The name of the folder is the Subject line of the email.
  3. All the attachments are saved to the folder 
  4. The body of email is saved as an .eml file to the same folder
  5. The SharePoint instance is an on-prem installation

The Problem: When files are created or modified by the flow, the created by and modified by properties are set to the owner of the flow. You want to

  1. change the Created by property of the newly created files to the From address in the email message
  2. change the Modified by property of the modified files to the From address in the email message

Is this correct?

 

Here are some things to check:

 

(1) Check the Uri property for the API. See the following posts:

 

(2) Please ensure the FieldValue is set as:

Snag_10153b1b.png

 

 

Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hi Ellis,

Thankyou for the clear response!

I have tried to use the url as mentioned in the above articles. Below is the screenshot.

Susmitha95_0-1662539499187.png

 

Error message is "Request is not Valid" Status:400.

Could you kindly suggest something on this.

 

Regards,

Susmitha.

Hi @Susmitha95 ,

 

Can you use the following logic to change the author property of the attachments and eml file:

Snag_15ff644a.png

Use the following API to change the author or editor:

 

_api/web/lists/GetByTitle('BDS Archive/FOLDER_NAME')/items(ID)/validateUpdateListItem

 

 Snag_83d9a2a.png

 

Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Susmitha95
Frequent Visitor

Hi Ellis,

I tried to use the URL that was mentioned above. It gives me a different error.

The list BDS Archive/test Proj sites does not exist on the site whose URL is

URL that is being used is : _api/web/lists/GetByTitle('BDS Archive/@{variables('Subject Variable')}')/items(@{outputs('Create_file')?['body/ItemId']})/validateUpdateListItem

 

Susmitha95_0-1662657982810.png

 

 

Regards,

Susmitha

Hi @Susmitha95 ,

 

I had a chance to create a working demo flow as shown below:

 

Snag_1ad916cd.png

These are the steps in my flow:

 

Snag_1ad4a8b5.png

Create a folder based on the emails Subject line:

Snag_1ad537b6.png

(You can change the Created by and Modified by properties of the folder if needed).

 

Save all attachments, 

Snag_1ad69f07.png

then change Created by and Modified by properties of the file: 

Snag_1ad7a888.png

Export the email and save to SharePoint:

Snag_1ada4bd3.png

then change the Created by and Modified by properties of the eml file:

Snag_1adb7ffd.png

This is the sample runtime output

ekarim2020_0-1662669537301.png

 

ekarim2020_1-1662669696012.png

 

Snag_1ae0380f.png

Hope this helps.

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hello Ellis,

Our issue has been resolved. your detailed steps helped a lot. Thanks so much for your support.

Regards,

Susmitha

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,286)