Created
October 2, 2019 11:48
-
-
Save jcallaghan/c2ded22feaa639f60fc08ea43ec3a883 to your computer and use it in GitHub Desktop.
See https://jcallaghan.com/2019/10/migrate-sharepoint-discussion-boards-to-yammer/ for more information. #Website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-BaererToken() { | |
$headers = @{ Authorization=("Bearer " + $token) } | |
return $headers | |
} | |
# Yammer app developer token | |
$token = "12345678-ABCDEabcdeABCDEabcdeAB" | |
# Base Yammer API url | |
$yammerBaseUrl = "https://www.yammer.com/api/v1" | |
# Create the json for a new message. | |
$messageBody = @{ | |
body = "Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other"; ` | |
group_id = "1234567890"; ` | |
is_rich_text = $false; ` | |
message_type = "normal"; | |
} | |
# Post new message to the messages API | |
$headers = Get-BaererToken | |
$messagesApi = "$($yammerBaseUrl)/messages" | |
$apiResponse = Invoke-RestMethod -Uri $messagesApi -Method Post -Headers $headers -ContentType "application/json" -Body (ConvertTo-Json $messageBody) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment