MS Flow Populate a SharePoint List from TXT File - sharepoint

I have a txt file, in OneDrive, with email addresses each on a newline with a header on the 1st line.
I want to populate a 1 column SharePoint list with the email addresses.
Here is my list and flow so far:
Which actions do I need to add?

My test flow for your reference:
Notes:This will insert an extra '\r' into the column, which can't be seen on the page, but it will be in the actual storage.

Related

How to automate a comparison and if no hit, delete a row of information?

I have an excel list of employees who have given input via microsoft forms.
I want to check automatically whether those people are still present in the organization.
If so, then the data may remain.
If not, the data must be removed from the excel sheet because it is used in a canvas app.
Also, if possible, I'd like the response to be removed from microsoft forms.
As far as we know there is no Excel list of persons present in the organization. However, all persons are loaded into, for example, Outlook or MS Teams.
What would be a good way to automate the comparison and then update the Excel file?
Form SharePoint side, you go to Microsoft 365 admin center -> Users -> Active users -> Export users to get csv list of present persons in the organization.
You could retrieve the responders via the FormAPI. You can retrieve the enabled accounts via List Users method with a $filter query via the Graph API.
After that you can compare those two arrays within a Filter Array action.
The output of that Filter Array action should be an array with the users which are disabled users who have responded to the form. You can loop through that array and remove the matching items from the Excel.
Below is an example of how to retrieve the users who have been disabled since they have responded to the Microsoft Forms form.
1.Use a Send an HTTP request to SharePoint action with a GET request to the forms.office.com
2.Use a Select action to get a clean array with only the responder mail addresses
a. Use the expression below in the From Field
outputs('Send_an_HTTP_request_to_SharePoint')?['body']['value']
b. Switch Map field to text mode (with icon on the right side) and add the expression below
item()['responder']
3.Use a Send an HTTP request to SharePoint action with a GET request to the forms.office.com
4.Use a Select action to get a clean array with only the users which have an enabled account in the tenant
a. Use the expression below in the From Field
outputs('Send_an_HTTP_request')?['body']['value']
b. Switch Map field to text mode (with icon on the right side) and add the expression below
item()['mail']
5.Compare the two arrays in a Filter Array
a. Use the Select - Forms action Output in the From Field
b. Use the following expression (in advanced mode) in the Criteria field
#not(contains(body('Select_-_AccountEnabled_Users'), item()))

Include a link in an email to document(s) in a SharePoint document library

I have the following list and document library in the same SharePoint site:
SharePoint List (Policy Inventory):
SharePoint Document Library (Policy-Working-Documents):
My current flow filters for items in the list with a review date that is +120 days from today, then it gets the files from the document library sub-folder named Test-Folder.
I am really struggling with the following:
Filtering the Get Files output so as to keep only the files with a Name that is also contained in the output of Get Items?
Send an Outlook email that contains the documents from #1 as an attachment or link. The body of the email should include the Document Name and Review Date which are provided in the Policy Inventory list.
My current flow:
Here's an example using the Get Files, Create HTML Table and Send an Email to achieve what was asked in the title:
First the Get Files and Create HTML Table -> the value in From is the collection received from the Get Files step
Then the final Send an Email step uses the output as the Body from the Create HTML Table step:
EDIT:
To filter the OData Get Files step use the following steps - Get Items from the list with file name filters
Then Initialize String Variable for the OData filter, append to that variable the following:
concat('or FileLeafRef eq', '''', items('Apply_to_each_3')?['Title'], '''')
That'll create the OData filter and use that in the Get Files step Advanced and Filter Query value.

Is there a way to collect the first file attached to an item in a sharepoint list?

I have a sharepoint list whose items are always created with a single attachment. Subsequently, any number of attachments may be added. A flow that works on this list sends emails to different people as appropriate. Most of these emails must have only the original attachment attached. The current solution is to impose a naming convention on the original attachment. The flow gathers the attachments and uses a conditional to select the attachment that matches the naming convention. It would be easier and more robust if the flow could select the attachment by date or order by which it was attached rather than by name.
Is there a way for Power Automate to select the attachment that was first attached to a single item in a sharepoint list?

Is there a possibility of selecting a specific range of data on excel using VBA code based of a column criteria?

In my data set, I have a column with a large number of email addresses, some repeating, some not.
I have inserted a new column to the right where I've copied the same list and removed duplicates.
I want to be able to use the list of removed duplicates to loop through the full column of emails and grab the data in the rows for each repetition of that email and paste that data into an email body send the email to that contact. Then, when there are no more repetitions of the first email in the list, it moves on to the next email in the list and does the same for each until it's gone through the complete list.
Is this something that's possible? My VBA experience is limited, so any help would be greatly appreciated.
Thank you in advance!
This is very doable in VBA. The best bet would be to either create an Access Database with a table that documents every time you send an e-mail to a certain e-mail address. That way you can check that list before generating another e-mail. It would work like this-> 1. Check to see if the e-mail is in the table. 2. If it is, then go to the next e-mail. 3. If it isn't insert the email into your table and send an e-mail. You could do this with a spreadsheet too, but I would prefer to use a table for this kind of thing. This table could be expanded upon to make a log as to when and what you sent to each user.

Sharepoint HTML Email outputs 5;#, 4;#, etc characters

I have a problem with SharePoint 2010 email sending. I have a list with a column (single line of text), for example the value is 'Apple'.
I have a workflow, what starts when the new item is saved and the email going out includes the [%Current Item:Apple%] lookup. The problem is, when the email arrives it shows '5;#Apple'.
I found this QA - Sharepoint HTML Email outputs Junk characters for "Domain\Username" values - but with the single line of text you cannot modify the "Return field as" since it's just a string.
How can you remove this extra character, the ID of the item?
Thanks.
added as it's possibly important: the source list is a standard list, but in the new item form you use it with a Resources Field, a resource list: http://office.microsoft.com/en-us/sharepoint-server-help/enable-reservation-of-resources-in-a-calendar-HA101810595.aspx
I ran across this post when researching a similar problem. Here's how I finally got it to work:
Create a new workflow variable with data type string.
Set the value of the variable to Current Item:Apple (the name of your Resources field).
Use the new variable in your email, and when doing so you will have many more options to return the field as (I used "Lookup Values, Comma Delimited", which just lists the names of the resources).

Resources