Using SharePoint REST Services to Control Email Notifications
Many of the InfoPath applications that I write involve notification emails and workflows as in the previous chapter. In most cases, however, we want to notify an entire office or workgroup rather than a specific individual. A useful technique is to have each office in a custom SharePoint list. Figure 138 shows the layout of the Office Members list. Anyone in this list will have permissions for their office’s section of the form. Notice that the Member Name column is of type Person or Group. We display its Account field so that when we reference it from InfoPath, it will match up with its userName() function. Later, we will use SharePoint’s REpresentational State Transfer (REST) service to read this same list in order to send notification emails to only those members that have a SendNotificationEmails column set to true. While we are at it, we give each user the option for giving one or more AlternativeEmailAddress rather than using the one associated with their SharePoint account.