Thursday, October 13, 2016

SharePoint 2013: The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly.

Problem

You create a simple notification workflow (2010 version) for a list.  The workflow is supposed to send an email to the individual who originally created the list item if a certain column, say, Status, is changed to a specific value, say, Completed.  All the workflow needs to do is send an email to the Created By person and include in this email all of the list item column values:
Email Current Item:Created By
and the Workflow start options are: Start workflow automatically when an item is changed.  The format of the Created By field returned to the workflow lookup is Display Name.  You check the workflow and there are no issues.  You publish the workflow without any issue.  You then test the workflow by changing the Status column for an item to Completed.  The workflow appears to complete successfully.  However, the intended recipient does not receive any email from the list; and when you check the workflow history, you see:
The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly.
This result is repeatable.  What's curious is that when you yourself create an entry in this list, and repeat the test on your own entry, an email is in fact sent out, and this result too is repeatable.  You commence troubleshooting.  NOTE: these troubleshooting steps do not include all ancillary steps explored, but review and list the actions performed in the main troubleshooting thread.

Troubleshooting

  1. Facts and Initial Observations
    1. Emails can be sent from other workflows and alerts in other site collections in the content web applications.  This indicates that farm level email settings are configured correctly
    2. Emails from the target workflow can in fact be sent if the workflow is triggered on the list entry this administrator created in the target list.  This indicates that the workflow is in fact functioning correctly and, specifically, that the workflow's email action is correctly configured and functioning.
  2. Check User Workflow Document content type Title property
    1. Using SharePoint Designer 2013, verified that the Title property of this content type is set to Optional. See Reference 1 for additional detail on the importance and impact of this content type property on workflow functioning.
  3. Change list Title property to Optional
    1. As administrator, changed list Title property to Optional.
    2. Removed all versions of workflow from list.
    3. Republished workflow to list
    4. Tested
    5. Email still not sent and fails with same error in Workflow History List.
  4. Add Log step to capture data
    1. Added step to workflow to log all different types of Created By formatted (ie, "Return field as"), including: String, Display Name, Email, Login and ID, to the Workflow History List.
    2. Removed all versions of workflow from list.
    3. Republished workflow to list
    4. Tested on original user not receiving email.
    5. Observed that the user's email address was not displayed but instead the user's login was shown. What was shown looked something like this:
      Created By (String): i:0#.w|DOMAIN\FIRST.LAST
      Created By (Display): FIRST LAST
      Created By (Email): i:0#.w|DOMAIN\FIRST.LAST
      Created By (Login): i:0#.w|DOMAIN\FIRST.LAST
      Created By (ID): [some integer]
    6. Tested workflow on my own list entry
    7. Observed that in contrast to this user, my email was shown. What was shown looked something like this:
      Created By (String): i:0#.w|DOMAIN\MYFIRST.MYLAST
      Created By (Display): MYFIRST MYLAST
      Created By (Email): MYFIRST.MYLAST@SOMETHING.COM
      Created By (Login): i:0#.w|DOMAIN\MYFIRST.MYLAST
      Created By (ID): [some integer]
  5. Check ULS
    1. Found curious entry
      The e-mail address 'FIRST LAST' contains illegal characters.
      also saw other curious messages (under same correlation ID):
      CSPRequest::SendMail. Error Detected. SendMail failed.
       
        Cannot complete this action.  Please try again.<nativehr>0x80004005</nativehr><nativestack></nativestack>
       
        System.Runtime.InteropServices.COMException: Cannot complete this action.  Please try again.<nativehr>0x80004005</nativehr><nativestack></nativestack>, StackTrace:
       
      SPUtility.SendEmail: Unmanaged SPRequest.SendMail failed
  6. Check server event logs
    1. Found no events occuring at the time of the workflow being launched
    2. Found no related events in system or application logs
  7. Check user's profile in Active Directory
    1. Verified that the user's email field in his AD profile did have an email address entered.
  8. Check site collection's hidden User Information List
    1. Found that the user was listed.
    2. No email address was listed for the user in this list.
  9. Check user's profile in User Profile Service
    1. Found that the user's profile in UPS did not have an email entered.
    2. Also found that the Department value was blank.
    3. Entered the user's email address into his profile and also entered the appropriate value for the user's Department.
    4. Performed Full Crawl on User Profiles.
    5. Tested workflow again on user.
    6. Email still not sent and fails with same error in Workflow History List.
    7. Also found that what was logged to Workflow History List for user was same as found in step 3.5, above.  Namely, the value returned for Email was still the user's login string.
  10. Change format of user lookup in Created By to Email
    1. Edited workflow lookup for user to return as Email.
    2. Saved workflow
    3. Removed all versions of workflow from list.
    4. Published edited workflow.
    5. Tested on user's entry.
    6. Still observed error.
  11. Perform Full Crawls of both User Profiles and My Sites
    1. Performed full crawls of both User Profiles and My Sites content sources.
    2. Removed all versions of workflow from list.
    3. Published workflow to list
    4. Tested on same user.
    5. This time, the user's actual email address is displayed for Created By (Email): log entry and no error is listed.

Solution

  1. Make sure that for sending emails via workflow that the user's login is entered (via workflow lookup) as type Display or Email.
  2. Make sure that the user's profile information in UPS is complete.  In particular, verify that the user has an email entered into his or her UPS profile.
  3. If any changes to the user's profile information in UPS are made, followup with full crawls of both user profiles and My Sites content.

Summary

There are many possible causes for this error message when launching workflows that send emails. In this posting, I have documented one possible cause.  In the future, I will add checks of user profile information in both AD and User Profile Service to my workflow troubleshooting; and if any profile changes are made to these sources, I followup with Full Crawls of both User Profile and My Site content sources.

References

Friday, October 7, 2016

SharePoint 2016: Databases running in compatibility range, upgrade recommended

Problem

You have perform an initial core install of SharePoint 2016 onto a single server.  You have not yet created user content web applications or instantiated any service applications. Later, you check Health Reports and see the following warning:
TitleDatabases running in compatibility range, upgrade recommended
Severity2 - Warning
CategoryConfiguration
ExplanationThe following databases have versions that are older than the current SharePoint software, but are within the backwards compatible range:
[central admin content database]. 
RemedyTo achieve optimal results from these databases, use Upgrade-SPContentDatabase to upgrade Content databases, or psconfig.exe to upgrade other databases. For more information about this rule, see
http://go.microsoft.com/fwlink/?LinkID=142697 
Failing Servers
Failing ServicesSPTimerService (SPTimerV4)
Rule SettingsView
Understanding this to be a content database, you open an elevated SharePoint Management Shell and execute the following commandlet: Upgrade-SPContentDatabase [central admin content database]. However, this returns an error: The content database could not be found.  This doesn't make sense. You begin troubleshooting.

Troubleshooting

  1. Check database status:
    1. In Central Administration, navigate to: Upgrade and Migration > Upgrade and Patch Management > Review database status.
    2. Found that the Central Administration content database was listed as Database is in compatibility range and upgrade is recommended.
  2. Get database instance
    1. In an elevated SharePoint Management Shell, executed Get-SPContentDatabase: this returned nothing.  This indicated that the farm content database is not considered to be a content database per se, even though it is in fact storing content.
    2. Execute Get-SPDatabase | ft -auto: this returns all databases: the farm content database and the farm configuration database.
  3. Execute PSCONFIG
    1. In an elevated SharePoint Management Shell, executed: Psconfig.exe -cmd upgrade -inplace b2b -wait -force.  Completed successfully.
    2. Navigate to: Upgrade and Migration > Upgrade and Patch Management > Review database status.  Found that 

Solution

  1. Execute PSCONFIG.

References