Emailing List Attachments in Office 365

Hello all! It’s been at least two years since I have posted something technical on my Salty Blog, pathetic right?. This how-to in my opinion was too good not to share as I believe that it will help others that are facing/have faced this issue.

The ability to email attachments from a list is one of those pain points that I seem to face all of the time. This documentation will take you through the process of setting up a new Flow that will grab all attachments for a single list item and will then email those attachments back out to the intended target.

Before I begin, let me preface this post stating that I did not come up with this. I found a couple of posts and podcasts but I wanted to compile this working version into one blog post.

I was searching for an answer on this issue late last year and attending one of Laura Roger’s weekly Power Hours and she presented on this. Here is a link to that original broadcast: SharePoint Power Hour: Flow Attachments & Files . If you follow the recording to the end, you will notice that Flow was not behaving properly. Well, I could not get it to work either and after a month of trying different things, I gave up.

A couple of months later I, I received an update from Microsoft’s Blog on Flow which is named Flow of the Week. This particular flow caught my eye: Send multiple attachments on a single email. I couldn’t believe it! This was exactly what the doctor ordered or at least I thought it was. I had setup the Flow as explained in the blog post but when I would run the Flow, I would receive the following message: “No input parameters provided. Please provide required input parameters ‘To’, ‘Subject’ and ‘Body'”

You’ve got to be kidding me!!!!!! Why is this not working for me?!?!?!?! I just want to send an email with the list attachments!!!!! I need this to work!!!!!

Ok, calm down……… After a couple of weeks had passed and after I tried all that I could think of to get around this error, I went back to that Microsoft blog post and noticed a comment by Vytenis Jazbutis. He explains how he was able to get around this with a “fix” for the issue of the final “send email” step. It doesn’t like and doesn’t want to add the full “file content” file from the array as an email attachment. What it wants instead is the .$content property within the file contained in the array.

I have decided to recreate the blog post showing the new way of grabbing the attachments with Vytenis’s fix. Once again, all props goes to Laura, Sunay and Vytenis of this.

With that being said, let’s dive into this and build out this Flow!

  1. Add a new “SharePoint – Create item” trigger and select the correct SharePoint Site and List.
    *** Please ensure that you already have SP List created that allows storing multiple attachments on the items in it.
  2. Add a new “Schedule – Delay” step
    *** I added this additional “Delay Step” because I was getting inconsistent results. Sometimes the trigger would fire too early and would send a blank email without grabbing the attachments. By adding this 30 second delay, it will give Flow the ability to run each step in the process before sending the email. You may not need this in your environment but in my experience even with SharePoint Designer workflows, I have to add these more often than not.
  3. Add a new “SharePoint – Get attachments” step

    *** This step will be grab all of the attachments added to the newly created list item. Use the Site name and List name from the previous step. We want to then pipe the output “ID” from the trigger, to the input ‘ID’ field.
  4. Add a new “Variables – Initialize variable” step
    *** This variable will be used to store all of the attachments in a single array.
  5. Add an “Apply to each” step.
    1. Click inside of the *Select an output box and click the “Body” output from the “Get attachments” section
    2. Click the “Add an action” button and select “SharePoint – Get attachment content”
    3. For the ID field, select the “ID” output from the “When an item is created” trigger section
    4. For the File Identifier field, select the “Id” output from the “Get attachments” section
    5. Click the “Add an action” and select “Variables – Append to array variable”
      1. For the Name field, select “attachmentArray” from the dropdown. (this was created in step 4)
      2. For the Value field, type in the following JSON statement:
        1. For “ContentBytes”, click between the : and , and then click on the “Expression” output
        2. Type in the following expression: body(‘Get_attachment_content’).$content and click the ‘OK’ button
          *** “Get_attachment_content” is the name of the step created in 5b. Don’t forget the underscores for spaces.
      3. For “Name”, click between the ” and : and select the “DisplayName” output from the “Get attachments” section
        *** See “Note” below on additional details about the “ContentBytes” parameter
        The completed step should look like the one seen here
  6. Add a new “Office 365 Outlook – Send an email” step
    *** Note: Use whatever mail client that you have setup to run this step.

    1. Fill in all of the required fields (if applicable to your mail client).
      *** I have a list value that I am using to populate my “To” field.
    2. Click the “T” icon next to the Attachments Name field. This switch will change the attachments control from “Detail inputs for array item” to “Input the entire array”
    3. For the Attachments field, select “attachmentArray” from the “Variables” section.

  7. The completed Flow should look like the following:

Save your Flow, then go to your list and create a new list item with attachment(s) to test. Remember to be patient if you put in the delay step. You should receive an email with the attachment(s) that you added to the list item.

This solves a lot of issues that I was having and I hope that it will help you in some way.

Stay Salty!

Partnering with Bible Belt Outdoors

I would like to take this time to thank Brett Hall for inviting me to become a pro staff member for Bible Belt Outdoors. I’m super excited and am looking forward to working with and representing this wonderful organization on the hunt. For now, you can follow us on Facebook @biblebeltoutdoors, Twitter @biblebeltoutdrs, Instagram @biblebeltoutdoors and check us out on the web at http://www.biblebeltoutdoors.com. Stay tuned for some exiting things that will be coming your way!

Steps for Successful Conversations

Recently, we have been learning how to deal with difficult conversations at work.  At first, I was a bit dismissive about the whole deal but after going though some of the training I realized that I could learn from this experience.

Here are some suggestions, not in any particular order, that I took away from those sessions that may help you when dealing with an uncomfortable conversation or meeting.

Being Prepared
“What is this about?  Why am I here?”
Try to think about what this conversation is about.  If possible, try and identify the mood of the other individual(s) to help better prepare you for what type of encounter this may be.  As hard as it may be, remember to remain positive throughout this process.  If you go into this with anger or negativity, it could make matters worse.  Smile 🙂

Extend an Invitation
“Would you like to sit down and discuss this issue?”
If you sense there may be friction between you and someone else, reach out to them.  Be genuine about the request.  If you feel that you are forced to do this, it’s going to show and will probably not help any situation.

Remain Open
“Yeah right, easier said than done!”
Sometimes, this is a little more difficult for me.  If I feel as if I have been mistreated, I tend to close up towards that person/situation….. Shield’s Up Captain!  This is where a positive approach comes into play.  As hard as it is, sometimes you just have to let your force fields down and listen to what the other person has to say.  There may have been another situation unrelated to your encounter that could have put the other person in a fowl mood and they passed that on to you.  Talk to them and be ready to listen.

Take Responsibility
“Hah, Wasn’t Me!”
Owning up is never easy.  This goes back to childhood for most of us…. “If I could just get away with it, I won’t get in trouble.”  The only issue with that statement is that 9 times out of 10, you are not going to get away with it.  As a professional, I have learned that I have to “Own” my mistakes rather than run from them.  Will there be consequences? Sure, but depending on how you handle the situation determines what the next action(s) will be.  You need to be able to handle both positive and negative feedback.  Use this as an opportunity to grow.

Share your Goal
“By the end of this meeting, I would like to know why this happened”
Use this as an opportunity to determine the purpose of this encounter.  I have spent many hours in meetings for what I thought was a valid reason, only to come out of it with two hours of my life wasted on non-productivity.  Set you a goal for the meeting and then share that.  Try to stay on topic (I know, I know… this is nearly impossible :p).  You should have a predetermined outcome of how you want the encounter to end.  Remember to compromise!

Share your Experience
“I don’t want this to happen to anyone else”
Often, we are faced with similar situations and realize halfway through “Haven’t I been here before?”.  It’s best to take the time and share with others.  For example, you may be faced with an irate user and you were able to diffuse the situation, but this happens more often than not.  Don’t be a punk and let you co-worker walk into this issue without any prior knowledge.  Prepare them… share your experience.

Invite Feedback
“So what you’re saying is….”
Use these opportunities to build upon the situation.  It’s always easier to try and hurry up difficulty situations because quite frankly, you just want this to be over.  This goes be to “Being Open” about the whole ordeal.  Use this time to ask questions.  For example, you could use phrases like “Do you have any suggestions for what I could have said or done differently?”, or “I do not want situations like this to occur in the future.  Could you help me learn from this?”.  Remember, this is just another opportunity for growth and professional development.

Co-create a Solution
“Hey, let’s get together and bang this out!”
There are times when it may be best to work out a process together.  This applies to both projects and/or goals that may have been set for you by your management.  Take the time to sit down and discuss what needs to be accomplished.  Try to come up with a mutual agreement (sometimes hard to do :p) as you work though this.  Remember that others look at problems differently and it’s good to see ideas from a different perspective.

Document the Conversation
“What was that meeting about…. I wish I would have wrote that down!”
Unfortunately, this has happened to me a few times.  With the advancements in smart phones I can at the very least take notes using my phone but using these devices can be frowned on based on perception.  At a previous job I was always told “Perception is Reality”.  This statement is “sort of” true.  I could be taking notes on my phone but the person I’m meeting with might think I’m just playing games or surfing the internet instead of paying attention.  Bring a notepad with you next time and listen to what is going on.  Pay attention to key words and don’t be afraid to ask the person on the other end to repeat what they just said or to slow down for just a bit so that you can finish with your note.  This is VERY important especially if you are working on a new project or your end of year review depends on steps dictated in that meeting.

In closing, I just wanted to state that I am no expert at any of these steps.  I am simply passing along information that I have been presented and my personal advise on how to handle the different situations.

Enjoy!

InfoPath – Limit a Repeating Section

I had a requirement in one of my forms to limit the number of repeating sections to be displayed.

I read through some blogs that gave me some ideas on how to increment the row number which was very helpful and got me on the right track. Check them out when you have a moment:

http://nickhurstblog.com/2011/08/26/infopath-2010-repeating-table-incremental-row-number/

https://alecpojidaev.wordpress.com/2010/01/07/accessing-previous-rows-in-repeating-group-for-browser-enabled-forms/

Basically, you will need to auto increment a number field when a new section is added to the form. There is a very simple way to handle this and it only takes one rule and one field.  To do this, follow these steps.

  1. Create a new interger field and add to your repeating group.  For this example, we will name it Count
  2. Right click on Count and click properties, then click the fx button.
  3. Check the box to Edit XPath (advanced) and enter in the following formula: count(../preceding-sibling::*) + 1
  4. Click Verify Formula then click OK
  5. Make sure ‘Refresh value when formula is recalculated’ is checked
  6. Click OK
  7. If you have not added the repeating section to your form, do this now
  8. Preview your form to make sure that everything is working properly
  9. Click on the repeating section and then click ‘Manage Rules’ in the ribbon
  10. Add the following formatting rule
    1. For the Condition:
      1. Field: Count
      2. is greater than or equal to 5
    2. Check ‘Don’t allow users to insert or delete this control’
  11. Preview your form

You should now see that you can only be able to add a total of five repeating sections.  You can change this number to limit what you actually need.

I have included an example template that demonstrates how this works.  Please note that this form was created in InfoPath 2013 and is a browser based form.

LimitRepeatingSection

Enjoy and Stay Salty!

 

PowerShell – How to retrieve all deployed solutions

One of the quickest ways to find out information about your installed solutions is to use PowerShell.  To do this, login to one of your WFE’s and open SharePoint Management Shell.  Then, type in the following command: Get-SPSolution | Export-Csv C:\DeployedSolutions.csv.  Open this file on your local machine (or whichever has Excel installed) and dissect as needed.

This will return a fairly good amount of detail regarding your current solutions including but not limited to:

  • Solution Name
  • When/where deployed
  • Version
  • Status

Enjoy!

SharePoint – Retrive the internal column name for lists/libraries using PowerShell

I have been using this method for some time now and decided to make a slight change to it.  I have been using the PowerShell method found here to find the internal column names for my lists and libraries.  It works great.  The only problem with this is that I have to modify the script each time I need to change the value of the list or site.  This is usually not a big deal since I generally am only looking at one list.  This was not the case the other day.  I needed to look at many different lists in the same site.  Instead of having to modify the script each time, I added a set of parameters to prompt me at the command line.  The code looks like this:

  1. Download Get Column Names Script
  2. Save the script to a directory on your SharePoint server
  3. Open the SharePoint Management Shell for PowerShell
  4. Navigate to the directory where you downloaded the script
    example:  d:\scripts
  5. Run the script: getColumnName.ps1
  6. Enter in the variables
    ***To include hidden fields, change {$_Hidden -eq $false} to {$_Hidden -eq $true}***

Your screen should resemble the following before the command runs

psGetCN

Mike Smith has a lot of great tips on his site.  I suggest that you check it out:  http://techtrainingnotes.blogspot.com/

Stay Salty!

InfoPath – Multiple attachments in one web based form

Attachments in InfoPath are great.  The only issue with this, is that you can only attach one file to your form at a time.  In order to get a around this, you will need to add a handy dandy repeating section.  I have also added a count box to show how many attachments have been added to your form.  You also will have the ability to hide all of your attachments.  That’s where the count comes in handy.

I like to use this hide function for my attachments especially when I have a form that goes through an approval process.  I have attached a starter form using these controls.  The ‘attCount’ field has a default value set to count how many controls have been added to your form.  There is one rule set for the repeating section to hide it the ‘hideAttachments’ is set to ‘TRUE’.

I saved the form in a 2007 web based format.  You should be able to open in all versions of InfoPath 2007 – 2013.

Download Multiple Attachments Form

Stay Salty!

PowerShell – Add or remove a site collection administrator from all sites

This is an issue I recently faced.  I needed to add myself as a site collection administrator to 100+ site collections.  I did not want to do this manually because it would have taken too much time.  So what did I do, I put it off until I got fed up with having to add myself manually each time I needed access.  I started searching for posts and found and excellent article on how to achieve this via PowerShell.

Here is the link to the original post: http://blog.henryong.com/2011/04/08/adding-or-removing-a-site-collection-administrator-from-all-site-collections/
This worked perfectly except for one minor detail….no progress indicator.  This is usually not that big of a deal since PowerShell takes care of business so quickly, but this time, I wanted to know where I was during each step of the process.  To do this, I added a loop counter to display the current percentage of operation.  Once the script has run, it will write back to your screen the exact number of site collections modified.

Thanks to Henry Ong over at The SharePoint Swiss Army Knife for the main script.

To remove someone from the site collection admins, simply change the variable $add = 1 to $add = 0.  What I did was create a separate script for removing and updated the verbage in the write progress to indicate that I was removing a user.

Stay Salty!

Cannot find the FAST site template

By default, the FAST search site template is missing.  It has to be enabled via PowerShell.  Luckily, this is a very simple process.

Perform the following steps to enable the template:

  1. Login to one of the web front ends
  2. Open the SharePoint Management Shell (PowerShell for SharePoint)
  3. Type or Copy/Paste in the following making sure to change the “Identity” to your site collection:

Your output should look like the below screenshot

fastfeature

Cannot publish InfoPath custom list form

Today, I ran across an issue when I went to customize a list with InfoPath.  I clicked on the ‘Customize Form’ button and it opened the item view in InfoPath as expected.  After I made my changes I went to publish my form.  I received the following error message:

“InfoPath cannot connect to the server.  The server may be offline, your computer might not be connected to the network, or InfoPath Forms Services 2010 might not be enabled on the server.  To fix this problem, start by checking your network connection, and then try again.”

Bummer!

After going through my normal rounds of troubleshooting (permissions, InfoPath, SharePoint logs, Event Viewer), I came across another blog that had the solution (at least, it worked for my issue)

Here is the link to the blog: http://brenthafnersblog.wordpress.com/2013/01/15/cannot-publish-infopath-forms-or-cutomized-list-forms-in-sharepoint-lists-2010/

Basically, all that needs to happen is that you need to reset InfoPath Form Services for that particular site collection.  To do that, just run the following PowerShell scripts from your SharePoint server:

Make sure to update the urls for the above commands

 

Enjoy and remember to Stay Salty!