I want to send en email and have that converted into news post in Sharepoint

kman202020 20 Reputation points
2024-07-11T00:29:59.7166667+00:00

Please help with this relatively simple ask (I think) which there are few recent answers on the MS community.

I would like to

  1. Send an email from outlook to a certain email address with a subject and body
  2. I want that email to go to Sharepoint and be converted into a News Post Is there a code that you can provide that can help me do this?

I appreciate your help.

Outlook
Outlook
A family of Microsoft email and calendar products.
4,065 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,871 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,620 questions
{count} votes

Accepted answer
  1. Emily Du-MSFT 47,471 Reputation points Microsoft Vendor
    2024-07-11T08:01:07.94+00:00

    Per my research, there is no PowerShell codes to achieve this.

    The most convenient and quickest way is to use Power Automate to achieve this.

    Here are steps:

    1.Trigger.

    enter image description here

    2.Add JSON codes to create a news post.

    { "__metadata": { "type": "SP.Publishing.SitePage" }, "PromotedState": 2, "PageLayoutType": "Article" }

    2

    3.Add JSON codes to add subject and body into the news post.

    { "LayoutWebpartsContent":"[{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"\\n Title area\\n \",\"description\":\"\\n Title area description\\n \",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{\"imageSource\":\"\"},\"links\":{},\"customMetadata\":{\"imageSource\":{}}},\"dataVersion\":\"1.4\",\"properties\":{\"imageSourceType\":2,\"title\":\"@{triggerOutputs()?['body/subject']}\",\"textAlignment\":\"Left\",\"showPublishDate\":false,\"authors\":[{\"id\":\"\",\"upn\":\"\",\"email\":\"\",\"name\":\"\",\"role\":\"\"}],\"showTopicHeader\":false,\"authorByline\":[\"\"],\"layoutType\":\"CutInShape\",\"titlePlaceholder\":\"Name your news post\",\"topicHeader\":\"\"},\"reservedHeight\":356}]","CanvasContent1":"[{\"controlType\":4,\"id\":\"1212fc8d-dd6b-408a-8d5d-9f1cc787efbb\",\"position\":{\"controlIndex\":2,\"sectionIndex\":1,\"sectionFactor\":12,\"zoneIndex\":1,\"layoutIndex\":1},\"addedFromPersistedData\":true,\"innerHTML\":\"@{triggerOutputs()?['body/bodyPreview']}\",\"emphasis\":{}},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true}}]","Title":"@{triggerOutputs()?['body/subject']}"}

    3

    4.Publish the news post.

    4


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. kman202020 20 Reputation points
    2024-07-16T17:42:07.0033333+00:00

    Thank you. Still working through it, but thank you for answering.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.