0

So in my SharePoint. I have a folder for Travel Requests. Due to the amount of information, and my supervisor's preference I can't just turn all the items on the Excel file into a list. (That would make my life too easy) Here is a copy of the file: enter image description here

So now, I am trying to set up the library to automatically read the Approver name so I can send them an email when the file is created, or to use the creator's department to find the correct person to receive the email.

Can this be done? And if it can, how do I do this?

I already treat this folder like a list for flow purposes, I just can't pull the manger's info from anywhere, and have no way to have the user give this info to SharePoint on item creation.

1

You can achieve using workflow. The current item Author manager and departments only can be fetched from the user profile.

In the workflow,

  • You have to make REST call to read the user profile, get the manager login name and
[%Workflow Context:Current Site URL%]/_api/sp.userprofiles.peoplemanager/getPropertiesFor(@v)?@v='[%Variable: loginName%]'
  • Add a second REST call to get the manager email which can be used to send an email and get the Id to update to the list item.

[%Workflow Context:Current Site URL%]/_api/web/siteusers(@v)?@v='[%Variable: managerLoginName%]'&$select=Id,Email

The complete workflow as follows

enter image description here

Note

  1. Make sure you need to activate the workflow can use app permissions under the site features.
  2. The app has rights to read user profiles.
0

Two ways it might be possible both require SharePoint designer.

1) When the uploader uploads the file they need to set the filename to the manager name/id that can be used as a look up for active directory/exchange.

For example at my work we use a "CDSID" that is a unique ID for each person in active directory. Something like first intitial. SharePoint workflow can extract a string of characters before the file extension and you can use that as a lookup to send an email to that manager email address and also use workflow to insert that name into a person or group lookup field that is your approver field.

OR

2) You can set it when they upload you can pull the supervisor/manager from the Created By field profile and by using workflow again and then setting that to the approver column and then send that approver email.

  • Well the created by field works just fine, and I can use it for the approved/denied email. But the file name is always auto generated when you choose new file, to book, book1,book2,etc. – Flotolk Jul 14 '17 at 17:50

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.