Microsoft Graph API - Approve Moderation Request - c#

I want to be able approve a moderation request through Graph API. I have referred to Approve Moderation Request. I was not able to get it to work. Although, there is a PowerShell script available at EWS Managed API and Powershell How-To Series Part 11 Moderation that I managed to get working.
This is not a supported feature in Graph API and therefore requires some tinkering. I would like some guidance on how to do this.
This is the JSON I am sending to the end point https://graph.microsoft.com/v1.0/me/sendMail
{
"message": {
"subject": "Approve:MessageName"
},
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "systemmailbox#domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
This is the response I receive
{
"error": {
"code": "ErrorInvalidRecipients",
"message": "At least one recipient isn't valid., A message can't be sent because it contains no recipients.",
"innerError": {
"date": "2020-08-19T23:40:07",
"request-id": "7g5h732v-6uhb-3212-b6f1-43f6eeb139wq"
}
}
}
Any help would be appreciated.

You have a syntax issue in your Json request eg look closely at the Message after subject you have a closing } which means the only thing your posting is the subject of the message it should be
{
"message": {
"subject": "Approve:MessageName",
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "address.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
}
Additional
To make this work correctly you need to get the Approval Request from an app rovers mailbox for the Graph a query like this
https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$filter=singleValueExtendedProperties/any(ep:ep/id eq 'String 0x001a' and ep/value eq 'IPM.Note.Microsoft.Approval.Request')&$expand=singleValueExtendedProperties($filter%3D(Id eq 'Binary 0x0031') or (Id eq 'String 0x0E1D'))
This will give you the report tag 0x0031 value that you need to use in your Send and you also need to include the Approve Verb Extended property
{
id = "String {00062008-0000-0000-C000-000000000046} Id 0x8524"
value = "Approve"
}
I converted the script from my blog which I'll get around to posting this week that just approves the last email in a Mailbox you can look at it https://github.com/gscales/Powershell-Scripts/blob/master/Graph101/Moderation.ps1 (look at Invoke-ApproveModerationRequest)

Related

DocuSign Electronic Signature : On signature window getting error "This authentication mode is not supported: NONE" ("Standards Based Signatures")

I am using Docusign API with a demo account. the signer gets this error on the signature:
This authentication mode is not supported: NONE
After doing some research I found that it's related to SBS ("Standards Based Signatures").
the problem is I can't found a way to make it work. Can someone help, please?
If your intention was to use Standards Based Signature in addition to eSignature, you may need to do additional work to get this working as well as ensure your account is configured/set up to use this feature.
Example of the JSON (taken from the page on this topic)
{
"signers": [
{
"routingOrder": 1,
"name": "Sue Collins",
"email": "sue#example.com",
"deliveryMethod": "email",
"recipientId": "1",
"recipientSignatureProviders": [
{
"signatureProviderName": "UniversalSignaturePen_OpenTrust_Hash_TSP",
"signatureProviderOptions": {
"oneTimePassword": "{YOUR_PASSWORD}"
}
}
]
},
{
"routingOrder": 2,
"name": "Yan",
"email": "jim#me.com",
"deliveryMethod": "email",
"recipientId": "2",
"recipientSignatureProviders": [
{
"signatureProviderName": "UniversalSignaturePen_OpenTrust_Hash_TSP",
"signatureProviderOptions": {
"sms": "+13303103330"
}
}
]
}
]
}

How to map object to proper query string for google analytics event in c#?

I need to send google analytics event from the server but can not find documentation on how to map the object properly.
I need to send event like this
{
"event": "nameOfEvent",
"ecommerce": {
"currencyCode": "eur",
"purchase": {
"actionField": {
"id": "9d9e3cc9-0007-4aaa-d986-08d6g2f07b63",
"affiliation": "",
"revenue": 100
},
"products": [
{
"name": "Product name",
"id": "id",
"price": 200,
"category": "Category",
"variant": "Buy online",
"quantity": "1",
"dimension1": "1",
"dimension2": "2",
"dimension3": "3"
}
]
}
}
}
Result should be similar to https://www.google-analytics.com/debug/collect?v=1&t=event&tid=UA-222-1&uid=1&el=nameOfEvent& here I have a problem, what to do next???
I would appreciate any help with it!
Looks like a possible duplicate of this. Manually sending data to Google Analytics.
The above post has references to C# implementation of the Google measurement protocol https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide.

How to know the interactions happened with the feed in stream?

My query goes like this: If I have a feedItem (an image posted on facebook), how can I verify that I have liked it or not? Can I verify all the interactions which I have done to the feedItem or the interactions other people have done to it (like, dislike, pin, share)? Is there any way in getstream.io to retrieve these interactions?
Thanks in advance...
Graph API provides all functions you need. Here are some examples:
Read shares[it's a field of an object]: https://developers.facebook.com/docs/graph-api/reference/v3.1/post#read
Read Shared posts: https://developers.facebook.com/docs/graph-api/reference/v3.1/object/sharedposts
read likes:
https://developers.facebook.com/docs/graph-api/reference/v3.1/object/likes#read
/likes returns only the profile for the current user if read with a
user access token:
Album, Photo, Post, Video
all returns are JSON, which you can directly Deserialize Anonymous Type without using stream, for example, likes:
{
"likes": {
"data": [
{
"name": "Bill the Cat",
"id": "155111347875779",
"created_time": "2017-06-18T18:21:04+0000"
},
{
"name": "Calvin and Hobbes",
"id": "257573197608192",
"created_time": "2017-06-18T18:21:02+0000"
},
{
"name": "Berkeley Breathed's Bloom County",
"id": "108793262484769",
"created_time": "2017-06-18T18:20:58+0000"
}
],
"paging": {
"cursors": {
"before": "Nzc0Njg0MTQ3OAZDZD",
"after": "NTcxODc1ODk2NgZDZD"
},
"next": "https://graph.facebook.com/vX.X/me/likes?access_token=user-access-token&pretty=0&summary=true&limit=25&after=NTcxODc1ODk2NgZDZD"
},
"summary": {
"total_count": 136
}
},
"id": "user-id"
}

Sending Messages through Microsoft Graph API with SchemaExtension Data

I'm looking for some help formatting schema extension data in Microsoft's Graph API. I've been able to successfully send Office 365 messages in code and through the Graph Explorer using this body:
{
"message": {
"subject": "Test Subject",
"body": {
"contentType": "Text",
"content": "Test Body "
},
"toRecipients": [
{
"emailAddress": {
"address": "foo#email.com"
}
}
]
}
}
I created a schema extension and promoted it to "Available" status. I can query the extension to verify it's available and get this response body:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#schemaExtensions",
"value": [
{
"id": "extc5bnq6uk_TestExtension",
"description": "Test Extension",
"targetTypes": [
"Message"
],
"status": "Available",
"owner": "mysecretclienttenantgoeshere",
"properties": [
{
"name": "ValueOne",
"type": "String"
},
{
"name": "ValueTwo",
"type": "String"
}
]
}
]
}
So far I haven't been able to append extension data to a new message. I've tried formatting my request body like this:
{
"message": {
"subject": "Test Subject",
"body": {
"contentType": "Text",
"content": "Test Body "
},
"toRecipients": [
{
"emailAddress": {
"address": "foo#email.com"
}
}
],
"extc5bnq6uk_TestExtension": {
"ValueOne": "TestValue",
"ValueTwo": "TestValue"
}
}
}
and like this:
{
"message": {
"subject": "Test Subject",
"body": {
"contentType": "Text",
"content": "Test Body "
},
"toRecipients": [
{
"emailAddress": {
"address": "foo#email.com"
}
}
],
"extensions":[
{
"extc5bnq6uk_TestExtension" : {
"ValueOne" : "TestValue"
"ValueTwo" : "TestValue"
}
}
]
}
}
Both formats return a 400 code with response body:
{
"error": {
"code": "RequestBodyRead",
"message": "The property 'extc5bnq6uk_TestExtension' does not exist on type 'Microsoft.OutlookServices.Message'. Make sure to only use property names that are defined by the type or mark the type as open type.",
"innerError": {
"request-id": "21792fd0-44d1-42aa-8d51-f8abc92cbd04",
"date": "2018-08-14T16:39:31"
}
}
}
I'm posting to this URL in the graph explorer:
https://graph.microsoft.com/v1.0/me/sendMail
and to the "messages" and "sendMail" endpoints in code.
I found the answer in the Known Limitations of the documentation. Certain resource types, including messages, have to be done in two stages, an initial post and then a follow up patch.
Creating the message and then patching with this JSON returned a valid response.
{
"extc5bnq6uk_TestExtension": {
"ValueOne": "Test Value One",
"ValueTwo": "Test Value Two"
}
}
Unfortunately, another limitation for schema extensions on messages is that they can't be used to filter messages, which is what I was ultimately after.
Filtering on schema extension properties (using the $filter
expresssion) is not supported for Outlook entity types - contact,
event, message, or post.
Jeff
Based on your question you posted, you have created a schemaExtension successfully. I think you want to send an email with this schemaExtension, but when you send an email with this schemaExtension, we get the 400 code in the response.
Based on my test, I think we can use the request body as blow.
1.Create a schemaExtension like this:
{
"#odata.context":"https://graph.microsoft.com/v1.0/$metadata#schemaExtensions/$entity",
"id":"{extensionId}",
"description":"sample description",
"targetTypes":[
"Message"
],
"status":"Available",
"owner":"{owner id}",
"properties":[
{
"name":"p1",
"type":"String"
},
{
"name":"p2",
"type":"String"
}
]
}
Create a message
POST https://graph.microsoft.com/v1.0/me/messages
{
"message":{
"subject":"Meet for lunch?",
"body":{
"contentType":"Text",
"content":"The new cafeteria is open."
},
"toRecipients":[
{
"emailAddress":{
"address":"{toRecipients email address}"
}
}
],
"extensions":[
{
"#odata.type":"Microsoft.Graph.OpenTypeExtension",
"extensionName":"{extensionName}",
"p1":"Wingtip Toys",
"p2":"10000"
}
]
},
"saveToSentItems":"false"
}
when we send this message with the request, we will get the 202 code. The {toRecipients email address} will receive the email.

How to post to a page timeline with Facebook C# SDK?

I have a website where I can post some contents. When I post a content, I want to also post a link/description to my Facebook page.
I've created an app, and then i got the App ID and App Secret. I asked for some permissions (publish_stream, manage_pages, offline_access) and then I got the access_token.
So, I think I have all I need: appid, appsecret, access_token, and these 3 permissions.
I'm logged in as the page administrator. I gave all the permissions to my app.
I'm using C#, so, there is some code:
var client = new FacebookClient(access_token);
client.AppId = appid;
client.AppSecret = appsecret;
var result = client.Post("/[MY_PAGE_ID]/feed",
new
{
picture = "http://some-picture.com/picture.jpg",
link = "http://random-link.com",
message = "A random message",
name = "My page's name",
description = "Other description",
});
The var result returns me the post ID.
A facebook page has 2 ID's: the User ID and the Page ID, right?
So, when I return to the facebook page, I can see the post in the "Recent Posts by Others on [MY PAGE's NAME]"
And then, the list of posts.
This is the WRONG place, I want to post to the wall.
When I click on the post, it opens a popup with more details. It has no information about the person who posted on my page. But I can get the ID of this person... and the ID is the same as the Admin ID of my page (the "person" who is logged in).
How can I make a post to my own page's wall?
When you post with your application, you use your appKey and AppSecret as log so you don't post with your account on the page but with the "application account".
{
"id": "170265327759_459817357429197",
"from": {
"id": "170265327759",
"category": "Computers/technology",
"name": "IntuiFace Presentation"
},
"message": "We just posted a preview video of IntuiFace Version 4.0 don't miss it! http://tmblr.co/Z4-xWvipid9i #intuiface #IFversion4.0 #preview",
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQBXteQsf4IidGU-&w=154&h=154&url=http%3A%2F%2Fimg.youtube.com%2Fvi%2FqsgXFg-6iaE%2F2.jpg",
"link": "http://tmblr.co/Z4-xWvipid9i",
"name": "Preview of IntuiFace Version 4.0 The IntuiFace...",
"caption": "blog.intuilab.com",
"description": "Preview of IntuiFace Version 4.0 The IntuiFace platform is already the world’s premier no-programming solution for the creation of interactive digital experiences. In Version 4.0 we are...",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/170265327759/posts/459817357429197"
},
{
"name": "Like",
"link": "https://www.facebook.com/170265327759/posts/459817357429197"
}
],
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2013-04-16T10:01:22+0000",
"updated_time": "2013-04-16T10:01:22+0000",
"likes":
{
"data": [
{
"name": "Roland Tomczak",
"id": "816909640"
},
{
"name": "Felipe Brito",
"id": "578018101"
},
{
"name": "Frank Coleman",
"id": "504788100"
},
{
"name": "Seb Meunier",
"id": "1513771056"
}
],
"count": 4
}
This is what a facebook page with a post look like it's a json file.

Categories