Tag : list

SharePoint – Change number of views displayed

This post will demonstrate how to change the number of views that are displayed for a list. Many thanks to Vadim Gremyachev for these concise details

Switch to Edit Page mode

ip1000

Add a Script Editor Web Part below your list

Use the ‘Media and Content Category’ to select and add the ‘Script Editor’ web part to your page. Click ‘Add’ and when it has been added, drag it below the list

ip1001

Add code into the web part

Add the following code to your web part (The statement ‘viewData.length -2’ is the one that tells SharePoint to display all views. If you wanted to only display 5 views for example, you would substitute 5 for this statement)

<script type=”text/javascript”>{
function renderHeaderTemplateWithAllViewsMenu(renderCtx, fRenderHeaderColumnNames){
var viewData = eval(renderCtx.ListSchema.ViewSelectorPivotMenuOptions);
ClientPivotControl.prototype.SurfacedPivotCount = viewData.length -2; //display all View options except ‘Create View’ & ‘Modify View’
return RenderHeaderTemplate(renderCtx, fRenderHeaderColumnNames); //render default Header template
}

SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Header: renderHeaderTemplateWithAllViewsMenu
}
});
}</script>

Save the page

The web part will now display all available views


Workflow – Useful REST calls – Listing views (and deleting them)

This REST call is useful for listing and deleting the list views. Be aware that the RAW call from a browser returns ALL Views, including Personal ones, while in SharePoint Designer only the public views are returned. Go figure! Nevertheless, here are the steps to list and delete Public Views

Define your Request Header dictionary

Add a ‘Build Diictionary’ action to create the header dictionary that specifies that the REST call must return data in JSON format. Create the Names ‘Accept’ and ‘Content-Type’ setting them both to the String value ‘application/json;odata=verbose’.
202-2

Click on ‘this’ and use the ‘Add …’ button to define the dictionary names ‘Accept’ and ‘Content‑Type’ as follows:
202-3
Both of these items have exactly the same value ‘application/json;odata=verbose

Instead of using the defaulted name of ‘dictionary’ in the ‘Output to’ command, I use my own name of ‘Header’. This change of name is optional. At any rate, after the dictionary changes have been made, the command looks similar to the following:
202-4

Define the dictionary that will be used to delete the views

Since we will also be deleting certain views in this process, we need to add a dictionary that specifies the elements to delete. Create a name called ‘X-HTTP-Method’ and set the value to ‘DELETE’ . Once defined, change the name of the dictionary to ‘DeleteHeader’

214-1

214-2

Build the REST Call string

Build the string that will return all the views. This is performed in 2 steps since the SharePoint Designer has an issue when the contents exceed 255 characters

214-3
[%Workflow Context:Current Site URL%]_api/Lists/GetbyTitle(‘Table Name’)/views

214-4
[%String01%]?$Top=500&$Select=Title,Id,ServerRelativeURL

Log the string that you have formulated to help if troubleshooting is necessary

214-5

 Make the HTTP (Rest) call to the Web Service with the string that you have previously defined

214-6

214-7

We are still not finished with the web service call yet.  Click on the right combo-box of the ‘Call’ action and select ‘Properties …’ and then set ‘RequestHeaders’ to the ‘Header’ dictionary previously defined

214-8

Get the results of the call

The rest call returns all the data into the ‘ResponseContent’ variable. Move the results into the a new dictionary variable called ‘ItemData’ so that you can count the number of items returned

214-9

Count the number of items so that we know how many views have been returned and store the value in a Workflow Variable called ‘CountOfItems’

214-10

Log the Response received from the call to assist in troubleshooting if necessary

214-11

Loop through the views returned

Initialize the variable you will use for looping through the views returned by the REST call

214-12

Create a loop for the number of items returned by the REST call

214-13

Get the Title of the returned item (View) for the current iteration and move it into the workflow string variable ‘ViewName’

214-14

Log the Title for troubleshooting purposes if needed

214-15

In my case, I only wish to delete specific views so I check a condition to make sure the view returned matches my parameters (For some reason, there are hundreds of views that have been created – not by the users but from somewhere else. This is a problem that Microsoft are investigating at the time of writing)

214-16

Get the Id of the view (this is the GUID) and save it in the Workflow Variable ‘ViewID’

214-17

 Formulate another REST string – this time to delete the view

214-18

[%Workflow Context:Current Site URL%]_api/Lists/GetbyTitle(‘Table Name’)/views(‘Variable:ViiewID%]’)

Log the string that you have formulated for troubleshooting purposes

214-5

Make the HTTP (REST) Call. Set this up as you did previously but click on the ‘Properties…’ and set the ‘RequestHeaders’ to the ‘DeleteHeader’ dictionary defined previously.

214-19

Check the Response code. If the delete was successful (ResponseCode = ‘OK’) write to the log and If the response was unsuccessful, get the error data returned and log the values to assist in troubleshooting

214-20

 Increment the counter so that we read the next row when the loop iterates

214-21

That is the end of the loop and the end of the process. The system should now run through the views and delete the ones selected

Final code

The entire code section is as follows (See next page for remaining screen dump. The ‘Update item in ‘Current Item’ statement is not needed):

214-22

214-23

 


SharePoint – Change Column Width

On occasion you may wish to change the column width within a SharePoint view. Many of the posts that I have seen recommend opening the view in SharePoint Designer and modifying the HTML script. To me this is cumbersome and the best solution I found that actually worked involved adding a webpart to the page where the view appears that changes the column sizes.

Here are the steps

Create a .txt file to define the column width

Create a .txt file(Say ChangeColumnWidth.txt) containing the code below:

301-1

<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js“></script>
<script type=”text/javascript”>
$(document).ready(function()
{
$(“TH.ms-vh2:contains(‘Description’)”).css(“width”, “300px”); // Add these lines for each column you wish to resize
$(“TH.ms-vh2:contains(‘Title’)”).css(“width”, “200px”); // Add these lines for each column you wish to resize
});
</script>

Upload the .txt file to a document library in SharePoint

301-2

Open the view who column widths you wish to change

I created a new view as shown below (Note the width of both the ‘Title’ and ‘Description’ fields)

301-3

Edit the page and add a Content Editor Web Part to the view

301-4

Edit the page and then add a content editor web part by following the steps 1,2 and 3 and then clicking on OK

301-5

Update the Web Part to refer to the file previously uploaded

Edit the web part by selecting the Edit Web Part option in the menu on the right hand side of the Content Editor Web Part.

301-8

Update the Content Link to reference the URL for the Text File that you previously uploaded (You can get this link by opening the file from the document library in SharePoint and copying the URL)

(https://contoso.sharepoint.com/sites/dev/Shared%20Documents/ChangeColumnWidth.txt)

Click on the ‘OK’ button when done

Stop editing the list

301-7

Save your changes by stopping the edit

Your columns now display in the correct width

301-9

 


InfoPath – Prepopulate a list item from a URL

In a previous post (InfoPath – Link to a list item from a URL) i detailed how to open a list item directly from a URL in a form. In some cases (actually many cases) it may be necessary to fill out the new form with data that comes from the calling form. For example, if you are adding attachments, you may want to pre-define the key of the ‘parent’ list

Basically, the ‘calling’ form defines a URL that includes as it’s suffix a parameter that specifies the data that is to be used when pre-populating the form. Also, when the user clicks on the URL, the system will use the ‘Query String (URL) filter’ Web Part to pass this value to an ‘InfoPath Form’ Web Part

Here are the steps involved

Define a field in your calling form to hold the URL you will use

In my example I added a text field called ‘URLAttachment’ as shown below

109-1

Click on the fx button to open the Formula dialog box and specify the formula as follows

109-2

Key values in this formula:

Lists/FA%20Attachments

This is the name of the list that you would like to link to and open with pre-populated data. My list name is ‘FA Attachments’

/Direct.aspx

The name of the view that the URL must open followed by .aspx. We will define this view later, but if you choose a different name in SharePoint, you will need to modify this value as well

&Details=

This specifies the name of the parameters that are being passed. In my case, I call these values ‘Details’ (This name will be used later  in the Filter (URL) Web Part)

Season,”<“,Product,”|”,ID

The value of the ‘Details’ parameters. Since the ‘Details’ parameter passes a single string value, I concatenate my data using  ‘<‘ and ‘|’ as delimiters so that I can easily separate the Season, Product and ID from the passed value in the called list. In the online documentation you will notice that it is not a simple task to pass multiple parameters and concatenating all your parameters into a single passed value makes it a simple task

Note. Be aware that WordPress modifies the standard quotation marks based on the display (not edit) font, so if you are cutting-and-pasting, you will need to change them back to standard format

Add a hyperlink field in your form

Add a hyperlink field in your form to link to this URL.

109-5

Select the INSERT tab, then click on the Hyperlink button and a screen similar to the following will be displayed

109-4

Select the ‘Data source’ radio-set and then use the ‘Select XPath’ button (highlighted above) to select the URL Field (in our case ‘URLAttachment’). Type some text into the Display Text fill-in so that it is clear that the user needs to click on this hyperlink to add an attachment

Your form will now display a Hyperlink to the appropriate list item as shown below in this section pasted from the form

109-6

The changes to the calling form have been completed – we now need to make some changes to the called form and the page in which it will be displayed

 Add a field to the ‘called’ List that will ‘contain’ the parameters that will be passed in the URL

Create a text field in the list that will be used to contain the passed parameters (this field will not be used for anything else – read my blog on InfoPath – Temporary fields in InfoPath form if you do not want to define additional fields in your list). In my case I created a single line of Text field called PassedParameters as shown below

109-7

 Define Rules for the field in the ‘called’ form

I then add the field to the called form and add the following rules

Formatting Rule to hide the field

I add a simple formatting rule that will always be true to hide the field as follows (Initially you may want to display the values in PassedParameters to make sure they are coming across correctly – in this case you can add the ‘Hide’ rule to the form after everything is running correctly)

109-8

Action Rule to update data when PassedParameters changes

The PassedParameters field will be automatically updated later, but in the form we need to decide what to do with the data it receives. In my case, I use the InfoPath substring-after function to get the ID of the document that this attachment relates to. With this value I can then query the list and set the default data in the form as shown in the screen shot below

109-9

Create a view on the list specifically for the URL

In SharePoint, create a view on the ‘called’ list that the URL will call. In my case, I named the view ‘Direct’ (To match my URLAttachment defined in the calling InfoPath form). Initially the View will look something like this (perhaps with some data underneath the headings):

109-11

Add the necessary Web Parts to your screen

From the Setting (Gear) icon, select ‘Edit Page’ as shown below

109-12

This will open a screen that looks similar to the following. Click on the ‘Add a Web Part‘ link

109-13

A screen will be displayed:

109-14

In the ‘Categories’ section, select ‘Forms’ and then choose ‘InfoPath Form Web Part’. Click on the ‘Add’ button  and the InfoPath Form Web Part will be added to your screen as shown below

109-15

Ultimately, this Web Part will display your form. Now we need to add another Web Part to the screen that will move the Parameters from the URL to the PassedParameters field that we created earlier. Click on the add button again as shown above and a screen similar to the following will be displayed

109-16

 In the ‘Categories’ section, select ‘Filters’ and then choose ‘Query String (URL) Filter’. Click on the ‘Add’ button and the Query String (URL) Filter Web Part will be added to your screen as shown below

109-17

Configure the Web Parts to update the PassedParameters  field

We now need the web parts to talk to each other. In the InforPart Form Web Part, click on the ‘Click here to open the tool pane’ link. A window will open on the right of the screen. In this window, set the List or Library to the list item that is being called (in my case this is FA Attachments) and set the ‘Content Type’ to ‘Item’. Leave all the other fields defaulted and then click on the ‘OK’ link at the bottom of the window to save your changes.

109-18

Once you click OK, you will notice that the input screen of your list is displayed as shown below

109-19

Now that the InfoPath Form Web Part has been configured, we need to link the passed URL parameters to this form. Click on the ‘Open the tool pane’ link (Shown in the image above highlighted with a red border). A Screen similar to the following will  appear

109-20

In the ‘Query String Parameter Name’ enter the name of the parameter that you want to pass to the InfoPath form. In our case, the data we wish to pass (to PassedParameters) is all contained in the parameter ‘Details’. Leave the other fields as they are and click ‘OK’ and the Query String (URL) Filter will change slightly and display a message that the filter is not connected. This is expected

109-21

Now, let’s connect the filter. In the top right of the ‘Query String (URL) Filter there is a small drop down indicator. Click on this indicator and you will notice that the menu has a ‘Connections’ option. Select ‘Connections’, then ‘Send Filter Values To’, then ‘InfoPath Form Web Part’, and a screen similar to the following will appear. Select the field ‘PassedParameters’ that we defined earlier (you will notice that other fields from your list are also available)

109-22

Click on ‘Finish’.

109-23

The job is completed and the ‘Called’ form will now open automatically with the pre-populated data when the link in the ‘Calling’ form is selected

Open your calling form

You are ready to test. Open your ‘Calling’ form and click on the link you defined and the ‘Called’ form should display as shown below (names and places have been changed to protect the innocent!)

109-24


InfoPath – Link to a list item from a URL

It is possible to open another list item directly from the form in another window. This can be useful when you wish to link to related items in another list or add another list item. This is done by building a URL that points to the list that you wish to link to. While the building of the URL can be performed directly in the Hyperlink Data Source, I have found that it is clearer to build the link in a field and then tie the Data source directly to the field.

Add a text field to contain the URL

Add a text field to the form, in the example below I added the field ‘URLAttachment’. Note that the checkbox ‘Refresh value when formula is recalculated’ is checked

ip0812

Using the fx button,set the default value to one of the following

To open the window in ‘Insert/Add’ mode:

concat(SharePointSiteUrl(), “Lists/<List Name>/item/newifs.aspx”)

ip0814

Ultimately, the concatenation statement would yield something similar to:

https://contosa.sharepoint.com/sites/DEV/capex/Lists/Capex%20Documents/item/newifs.aspx

To open the window in Edit mode (ID = the ID of the item you wish to open):

concat(SharePointSiteUrl(), “<List Name>/Forms/EditForm.aspx?ID=235”)

ip0813

Ultimately, the concatenation statement would yield something like

https://contosa.sharepoint.com/sites/DEV/capex/Capex/Forms/EditForm.aspx?ID=235

If you are using an InfoPath form, the concatenation is different since you must open the XML document:

concat(SharePointSiteUrl(), “_layouts/15/FormServer.aspx?XmlLocation=”, substring-after(SharePointListUrl(), “.com”), <FileName>, “.xml&ClientInstalled=true&DefaultItemOpen=1&Source=”, SharePointSiteUrl(), “SitePages/CloseWindow.aspx”)

where <FileName> is the name of the XML file without the .xml extension (you may have to store this value in a variable in your form – mine is shown as File_x0020_Name[ID = OriginalCapex] in the figure below).

ip0811

NB. The code from ‘&Source=’ onwards is optional and is used to close the window automaticallt when the form is closed (See InfoPath – Close window automatically). Ultimately, the concatentation would yield something like

https://contosa.sharepoint.com/sites/JAH-DEV/capex/_layouts/15/FormServer.aspx?XmlLocation=/sites/DEV/capex/Capex/C16081611166332.xml&ClientInstalled=true&DefaultItemOpen=1&Source=https://contosa.sharepoint.com/sites/DEV/capex/SitePages/CloseWindow.aspx

Create a hyperlink in your form

Enter the text that you want the user to see for the prompt (For example: Click here to add an attachment) into a cell as follows

108-5

Tie the hyperlink’s ‘Link To Data Source’ to the created field

Highlight the line you typed in the previous step, right click and select ‘Hyperlink …’. A dialog box will open up. In the ‘Link To’ section, click on the radio-set option ‘Data source’ and then click on the Field Selector button to open up the Field Selection Dialog Box. From this box, select the field that you created in the first step above. Click ‘OK’ to save your settings

108-5

Publish the form

The link will now appear as a hypertext as shown below. Publish the form and whenever the hyperlinked text is selected, a new window will open with either the New or Edit form displayed

108-6

Notes on the above

  1. If your list has spaces in the name, you need to substitute ‘%20’ for each space
  2. This document was originally defined in MS/Word which sometimes changes the character representation when the font changes. To make sure that the quotation marks don’t change (as I have found they often do), make sure to replace any quotation marks copied from this document with new quotation marks
  3. It may be possible to use a similar URL structure in emails to allow the user to click the hyperlink directly from within the email, but I have come across some issues with buttons being enabled and you may have to use a different URL within emails

Workflow – Useful REST calls – Attachments in email

From a workflow, you may want to find the attachments that are linked to a list item or even display these attachments within the body of an email. The next steps will guide you through this process. For those among us who are impatient, most of the entire process is shown in the figure below

203-1

Build a dictionary variable

Select the ‘Build a dictionary’ action and click on ‘this’ and use the ‘Add …’ button to define the dictionary names ‘Accept’ and ‘Content Type’, both og which are defined with exactly the same value: ‘application/json;odata=verbose’

203-2

202-3

Change the name ‘dictionary’ to specify a new dictionary variable ‘Header’. The end result looks as follows

203-3

Define the REST call 

Set a variable (String01 in this case) to the HTTP Web Service Call (REST Call) that will get the attachments. This is set to a combination of your site, list and list item as follows

<site>_api/web/lists/getbytitle(‘[%Workflow Context:List Name%]/items([%Current Item:ID%]/AttachmentFiles

203-4

This will return all attachments related to the current item. If you were looping through all items in the list, you could leave out the ([%Current Item:ID%])

Call the web service

Use the REST string previously defined in the ‘String01’ variable to call the web service, setting the ‘RequestHeaders’ in the Properties to the dictionary variable previously defined

203-7

203-6

Data Returned from HTTP Web Service call

When the HTTP Call executes, it will return a packet of data to the ResponseContent variable ‘Response’ that looks similar to the following (Note that is your ‘RequestHeaders’ are set as defined previously, the system will return values in JSON format:

XML (Multiple iterations of ‘value’ removed to save space):

<?xml version=”1.0″ encoding=”UTF-8″ ?>
<odata.metadata>https://contoso.sharepoint.com/sites/dev/_api/$metadata#SP.ApiData.Attachments</odata.metadata>
<value>
    <odata.type>SP.Attachment</odata.type>
    <odata.id>https://contoso.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a-a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Ferrari 2.jpg’)</odata.id>
    <odata.editLink>Web/Lists(guid’f2c6ac85-9999-222a -a306-2433922ff36d’)/Items(154)/AttachmentFiles(‘Ferrari%202.jpg’)</odata.editLink>
    <FileName>Ferrari 2.jpg</FileName>
    <ServerRelativeUrl>/sites/dev/Lists/Utility Jobs/Attachments/154/Ferrari 2.jpg</ServerRelativeUrl>
</value>

JSON:

{
    “d”: {
        “results”: [
          {
                “__metadata”:
{
                    “id”: “https://contosa.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a-a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Ferrari 2.jpg’)”,
                    “uri”: “https://contosa.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a-a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Ferrari%202.jpg’)”,
                    “type”: “SP.Attachment”
                },
                “FileName”: “Ferrari 2.jpg”,
                “ServerRelativeUrl”: “/sites/dev/Lists/Utility Jobs/Attachments/154/Ferrari 2.jpg”
         },
            {
                “__metadata”: {
                    “id”: “https://contosa.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a -a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Ferrari.jpg’)”,
                    “uri”: “https://contosa.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a-a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Ferrari.jpg’)”,
                    “type”: “SP.Attachment”
                },
                “FileName”: “Ferrari.jpg”,
                “ServerRelativeUrl”: “/sites/dev/Lists/Utility Jobs/Attachments/154/Ferrari.jpg”
            },
            {
                “__metadata”: {
                    “id”: “https://contosa.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a-a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Maserati.jpg’)”,
                    “uri”: “https://contosa.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a-a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Maserati.jpg’)”,
                    “type”: “SP.Attachment”
                },
                “FileName”: “Maserati.jpg”,
                “ServerRelativeUrl”: “/sites/dev/Lists/Utility Jobs/Attachments/154/Maserati.jpg”
            }
        ]
    }
}

Note: If you forgot to specify that your ‘ResponseHeaders’ are in JSON format, then the above values will be returned with ‘value’ instead of ‘d/results’ as shown below. This will cause the following commands not to work:

{
    “odata.metadata”: “https://contosa.sharepoint.com/sites/dev/_api/$metadata#SP.ApiData.Attachments”,
    “value”: [
        {
            “odata.type”: “SP.Attachment”,
            “odata.id”: “https:// contoso.sharepoint.com/sites/dev/_api/Web/Lists(guid’f2c6ac85-9999-222a-a306-9500622ff36d’)/Items(154)/AttachmentFiles(‘Ferrari 2.jpg’)”,
            “odata.editLink”: “Web/Lists(guid’f2c6ac85-9999-222a-a306-2433922ff36d’)/Items(154)/AttachmentFiles(‘Ferrari%202.jpg’)”,
            “FileName”: “Ferrari 2.jpg”,
            “ServerRelativeUrl”: “/sites/dev/Lists/Utility Jobs/Attachments/154/Ferrari 2.jpg”

If you look closely at the JSON data above, you will notice that there are multiple iterations of the ‘value’ data element. Since we need to know how many attachments there are, we must move all these iterations into a separate data dictionary to count them. Add a ‘Get’ action to move the ‘’d/results’ elements from variable ‘response’ into the dictionary variable ‘ItemData’

203-9

Count the number of items (Attachments) returned

Once the ‘d/results’ iterations are in the ‘ItemData’ dictionary variable, we count them with the ‘Count Items’ action and place the value in the integer workflow variable ‘CountOfItems’

203-10

Initialize the variables for the loop

Initialize the workflow variable (Count) that will indicate which iteration we are working through in the list. While the kneejerk reaction is make this an integer variable, I recommend making it a ‘Number’ variable since it will save a workflow step when this value is incremented later (Don’t concern yourself that it sets the value to 0.0 – it is still 0)

203-11

Since we will be creating a ‘special’ HTML string that will contain the images of the attachments (In this case I know the attachments are images), we need to empty this string first. Use the following command to set ‘String03’ to empty

203-12

Loop through the attachments (items) returned

Insert a ‘Loop n Times’ action that will loop the number of times indicated by the attachment count you set earlier in the ‘CountOfItems’ variable. This loop will be used to iterate through the ‘values’ returned by the call and build up the data that we wish to include in an email

203-13

Read each attachment

Use a Get statement to read the ServerRelativeURL from the data returned by the HTTP Call for the current iteration indicated by [%Variable:Count%] (the first iteration will be 0, the second 1 and so on). You will notice that I included this statement in a step to make the coding more readable

203-14

It is also possible to get this value from the ItemData dictionary variable defined earlier to get the count from the ‘ItemData’ dictionary instead of the ‘Response’ dictionary using the following action:

Get ([%Variable:Count%])/ServerRelativeURL from Variable:ItemData (Output to Variable:String01)

While this possibly makes it easier to read, I decided to use the structure from the top down to provide more understanding about what is going on

Use a Get statement to read the ‘FileName’ from the data returned by the HTTP Call for the current iteration indicated by [%Variable:Count%]. Follow the same process as you did for the ServerRelativeURL

203-15

‘Fix’ the data by replacing special characters

Replace any special characters (such as spaces and exclamation marks) in the ServerRelativeURL to ensure that if the user clicks on the link it will open up correctly. In my example I replace commas (,), exclamation marks (!) and spaces ( ) with the appropriate encoded characters (%2C, %21 and %20)

Thereafter, log the result (optional) if you wish to view the final URL

203-16

Add the image into the final string that will go into the email

Now that we have the Server Relative URL and the File Name of the attachment, we can construct the body of the email. In my case, I wish to embed the pictures within the email but you could also define a link to the image instead

203-17

As a convenience, I have included the text values here so you can cut and paste if necessary (Note that the [%Variable:String01%] and [%Variable:String03%] will have to be substituted with actual look-ups

[%Variable:String03%]
<tr>
       <td style=”width: 193px”><a href=”[%Variable:String01%] “>
       <img src=”[%Variable:String01%] ” width=”175″/></a></td>
       <td style=”width: 9px”>&nbsp;</td>
       <td style=”width: 600px”><strong><font face=Calibri size=”2″>[%Variable:String02%]</font></strong><br/>
       <br/>
</tr>

‘String03’ is made up of String03 and the new image contained in ‘String01’ together with the title of the attachment in ‘String02’

Increment the counter

Once we have finished with the list item, increment the counter and restart the process for the next iteration. You will notice that because the variable ‘Count’ is a number (as opposed to an integer), you can simply increment its value by adding 1. If the count variable was created as an integer, you would have to first increment a number value and then set the integer value to the incremented number value, requiring two steps

203-18

Define the email

The last step is added AFTER the end of the loop and emails the filenames and images to someone. In this case, the system will email the individual that is maintained in the people picker field ‘Current Item:User’. This is a very simple email but should serve to illustrate what to do. Feel free to add any additional details

203-19

Final result

You should be good to go and your code should then send an email similar to the following (The Maserati was too expensive and was trimmed off to save space)

203-20