Follow Me

Error sending emails to external users in SharePoint online (2013 experience)

By Stefan Feenstra   /     Oct 03, 2013  /     Office 365  /     0 Comment

In our Office 365 environment I tried to create a SharePoint Designer workflow to send an email to external users. The following error message is displayed in the workflow history: “HTTP BadRequest https://[tenant][sitecoll]/_vti_bin/client.svc/sp.utilities.utility.SendEmail”Unable to send emails external users

I created a new workflow and selected as platform type “SharePoint 2013 workflow”.

SP2013 -Unable to send email external3

It seems like in the new SharePoint Online 2013 workflow engine it is not possible anymore to send messages to unknown e-mail addresses. Microsoft suggested the following workaround: add the users as contact in Exchange. This has the following disadvantage: it takes +/- 3 days to show up in SharePoint.

Add contact in Exchange

Another workaround I found out is to recreate the workflow and select as platform type “SharePoint 2010 workflow” .

Unable to send emails external users

Add the email action to the workflow. And publish the new workflow to SharePoint.

SP2013 -Unable to send email external5

Start the workflow in SharePoint and now you will receive the email message.

SP2013 -Unable to send email external6

Continue Reading

How to use ‘Microsoft.SharePoint.Publishing’ assembly in a Sandboxed Solution

By Stefan Feenstra   /     Aug 01, 2013  /     SharePoint 2013  /     2 Comments

When you try to use the ‘Microsoft.SharePoint.Publishing.dll’ in your sandboxed solution you will get the following error:

You could still use the benefits of ‘Microsoft.SharePoint.Publishing.dll’. First download the tool ILSpy (ILSpy is a free .NET Assembly Browser and decompiler). With this tool it’s possible to view the content of this dll file.

For example you would like to configure the associated content type of a page layout programmatically :

Normal solution with Microsoft.SharePoint.Publishing

var exampleContentType = new SPContentType(…
var examplePageLayout = new PageLayout(…
examplePageLayout.AssociatedContentType = exampleContentType;

Solution without Microsoft.SharePoint.Publishing

  1. Load the ‘Microsoft.SharePoint.Publishing.dll’ in ILSpy
  2. Search for the ‘PageLayout’ class
  3. Search for the property ‘AssociatedContentType’
  4. This property contains the following code:

  5. Now when you click on the FieldId.AssociatedContentType reference you will see this is a Guid that references to a field in SPListItem

  6. Conclusion: you could also write:

    var examplePageLayoutListItem = new SPListItem(…
    var AssociatedContentType = new Guid(“b510aac1-bba3-4652-ab70-2d756c29540f”);
    examplePageLayoutListItem[AssociatedContentType] = exampleContentType;

Now you don’t need to use the Microsoft.SharePoint.Publishing dll in your solution. (Also working on SharePoint Online)
This was just a very small example of what you can do with the Microsoft.SharePoint.Publishing dll in a Sandboxed Solution.

Continue Reading