Xamarin.Android: open specific event in calendar from another app - c#

I'm currently working on an app in Xamarin.Android with one of the features being that, upon clicking a button, the user is taken to a specific calendar event in the Microsoft Outlook app. Thus far I've been using the Microsoft Graph API to get the event items and I've succeeded in opening the Outlook app to the calendar or opening Outlook with an error message saying "Event could not be opened" but I haven't gotten both behaviors to happen, nor the specific event item to open. The way I open the Outlook app is by calling the device's default browser with an Outlook uri scheme. Both are provided below
browserLaunch("ms-outlook://events/open?account={my.account#email.com}&restid={id}");
private async void browserLaunch( string uri ) {
await Browser.OpenAsync(uri, BrowserLaunchMode.SystemPreferred);
}
The exact call I've been making to the Graphs API is as follows
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2020-01-23T15:54:40.377Z&enddatetime=2020-01-30T15:54:40.377Z
which returns a list of even items with the following scheme:
"#odata.etag": "string",
"id": "string",
"createdDateTime": "20##-##-##T##:##:##.######Z",
"lastModifiedDateTime": "20##-##-##T#3:##:##.#######Z",
"changeKey": "string",
"categories": [],
"originalStartTimeZone": "Central Standard Time",
"originalEndTimeZone": "Central Standard Time",
"iCalUId": "string",
"reminderMinutesBeforeStart": int,
"isReminderOn": true/false,
"hasAttachments": true/false,
"subject": "string",
"bodyPreview": "string",
"importance": "string",
"sensitivity": "string",
"isAllDay": true/false,
"isCancelled": true/false,
"isOrganizer": true/true,
"responseRequested": true/false,
"seriesMasterId": null,
"showAs": "string",
"type": "string",
"webLink": "https://outlook.office365.com/owa/?itemid={id}&exvsurl={int}&path=/calendar/item",
"onlineMeetingUrl": null,
"recurrence": null,
"responseStatus": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "string"
},
"start": {
"dateTime": "20##-##-##T##:##:##.#######",
"timeZone": "UTC"
},
"end": {
"dateTime": "20##-##-##T##:##:##.#######",
"timeZone": "UTC"
},
"location": {
"displayName": "string",
"locationType": "string",
"uniqueId": "string",
"uniqueIdType": "stirng"
},
"locations": [
{
"displayName": "string",
"locationType": "string",
"uniqueId": "hexstrin-hexs-hexs-hexs-hexstringhex",
"uniqueIdType": "string"
}
],
"attendees": [
{
"type": "string",
"status": {
"response": "string",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "string",
"address": "my.account#email.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "string",
"address": "my.account#email.com"
}
}
I've also tried different ids that are given by the graphs API for the restid param. Thus far I've used the itemid param found in the url of the webLink field, the id of the json object, the changeKey, and the iCalUId but those last two didnt get me anything beyond just opening up Outlook.
I've also just passed in the webLink but it just opens a lightweight browser (and get's stuck on a white page) which I don't want as I need it specifically to go to the Outlook app. Any ideas?

So the best current solution I have been able to find is to open up a lightweight browser using a different url scheme than any prior:
https://outlook.office365.com/calendar/item/{webLinkItemId}
where webLinkItemId is the itemId param from the webLink url gotten from the returned Graphs API json object. You can find that complete object above in my original post but what you're looking for within that object is the following field
"webLink": "https://outlook.office365.com/owa/?itemid={webLinkItemId}&exvsurl={int}&path=/calendar/item"
You want to take the {webLinkItemId} string embedded in the url above and plug it into the corresponding spot in the scheme above

Related

What do I need to do to make a Teams bot callable

I'm trying to create a Microsoft Teams bot that can be called. Especially, we plan to use it as a destination for incoming calls on a Call Queue.
It seems that the call buttons
we usually get with contacts are nowhere to be seen on this bot:
So far, I have managed to create a bot according to the samples.
In https://dev.botframework.com/, the bot appears and I have the Enable Calling flag set (which - interestingly, seems to get disabled almost every time I run the project in Visual Studio).
My permissions.json looks like this:
[
{
"resource": "Microsoft Graph",
"delegated": [
"User.Read"
],
"application": [
"Calls.Initiate.All",
"Calls.InitiateGroupCall.All",
"Calls.JoinGroupCall.All",
"Calls.AccessMedia.All"
]
}
]
My manifest.template.json looks like this:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.13/MicrosoftTeams.schema.json",
"manifestVersion": "1.13",
"version": "1.0.0",
"id": "{{state.fx-resource-appstudio.teamsAppId}}",
"packageName": "com.microsoft.teams.extension",
"developer": {
"name": "Teams App, Inc.",
"websiteUrl": "{{state.fx-resource-frontend-hosting.endpoint}}",
"privacyUrl": "{{state.fx-resource-frontend-hosting.endpoint}}{{state.fx-resource-frontend-hosting.indexPath}}/privacy",
"termsOfUseUrl": "{{state.fx-resource-frontend-hosting.endpoint}}{{state.fx-resource-frontend-hosting.indexPath}}/termsofuse"
},
"icons": {
"color": "resources/color.png",
"outline": "resources/outline.png"
},
"name": {
"short": "{{config.manifest.appName.short}}",
"full": "{{config.manifest.appName.full}}"
},
"description": {
"short": "Short description of {{config.manifest.appName.short}}",
"full": "Full description of {{config.manifest.appName.short}}"
},
"accentColor": "#FFFFFF",
"bots": [
{
"botId": "{{state.fx-resource-bot.botId}}",
"scopes": [
"personal",
"team",
"groupchat"
],
"supportsFiles": false,
"supportsCalling": true,
"supportsVideo": true,
"isNotificationOnly": false
}
],
"composeExtensions": [],
"configurableTabs": [],
"staticTabs": [],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [],
"webApplicationInfo": {
"id": "{{state.fx-resource-aad-app-for-teams.clientId}}",
"resource": "{{state.fx-resource-aad-app-for-teams.applicationIdUris}}"
}
}
I also believe to have configured the correct permissions on the App Registration in Azure:
Any idea where to look next? What do I need to do to make the bot directly callable as I would be able to with any other user?

Waterfall model with adaptive cards in v4.0

I'm trying to create a water fall model with the help of Adaptive cards in C# version 4.0.
My scenario is like following:
On loading bot following cards will be shown:
1. SharePoint
2. Azure
3. O365
Once I click on any of them then new set of cards will be shown like:
On selecting "SharePoint" following cards will be shown:
1. Create a Site
2. Create a sub site.
and on selecting any of the above choices a form is called with set of questions like:
1. what is site title
2. site owner
and so on..
UI as shown below:
I tried creating the structure on https://adaptivecards.io/, but couldnt find any relevant code related to this type of scenario.
If any one has done it before please share the documentation or code snippet.
Thanks
Here's a basic card with Input.ChoiceSet:
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"items": [
{
"type": "Input.ChoiceSet",
"id": "first",
"placeholder": "Placeholder text",
"choices": [
{
"title": "SharePoint",
"value": "SharePoint"
},
{
"title": "Azure",
"value": "Azure"
},
{
"title": "O365",
"value": "O365"
}
],
"style": "expanded"
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
Then, in your bot, follow these answers for dealing with User Input:
Using Adaptive Cards in Waterfall Dialogs
(optional) Dynamically Changing The Card Before Sending
Basically, you'll want to:
Send the card
Capture the card's input by sending a blank text prompt right after sending the card (as explained in the first link)
Use if or switch statements in the next step to determine which card to display next based off of the user's input. You could optionally create the card more dynamically using the second link
The AdaptiveCards Designer is pretty good, but it lacks the ability to set the actions property. You can do so manually, by adding (like I did above):
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
],
Using Images
If you'd like to use images instead of a ChoiceSet, you can do something like this:
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"items": [
{
"type": "Image",
"id": "choice1",
"selectAction": {
"type": "Action.Submit",
"title": "choice1",
"data": {
"choice": 1
}
},
"url": "https://acuvate.com/wp-content/uploads/2017/02/Microsoft-Botframework.fw_-thegem-person.png",
"altText": ""
},
{
"type": "Image",
"id": "choice2",
"selectAction": {
"type": "Action.Submit",
"title": "choice2",
"data": {
"choice": 2
}
},
"url": "https://acuvate.com/wp-content/uploads/2017/02/Microsoft-Botframework.fw_-thegem-person.png",
"altText": ""
},
{
"type": "Image",
"id": "choice3",
"selectAction": {
"type": "Action.Submit",
"title": "choice3",
"data": {
"choice": 3
}
},
"url": "https://acuvate.com/wp-content/uploads/2017/02/Microsoft-Botframework.fw_-thegem-person.png",
"altText": ""
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
The important part is making sure that the Action.Submit:
Is on the image
Has data that you would use to capture which choice the user selected

RequestTemplate call returns a SigningGroupID of 0

I have a template in DocuSign that contains a SigningGroup as one of its recipients. when I tried to retrieve this template via C#/SOAP, the value of SigningGroupId is 0 and SigningGroupIdSpecified false. Is there any setting I need to enable or a flag I need to set to true to be able to correctly retrieve the recipient's SigningGroupId?
Below is the code to retrieve the template
dsApi.RequestTemplate(templateId, false);
dsApi obviously contains the reference to the SOAP API loaded in C#
Image below shows the SigningGroupId value returned by the API
Thank you and good day
I think its not possible to get it via SOAP API, instead you can get the same via REST API
GET /v2/accounts/{accountId}/templates/{templateId}/recipients
Details are available at RecipientList
Response will look like:
{
"creationReason": "sender",
"isBulkRecipient": "false",
"name": "TestSigningGrp",
"email": "",
"signingGroupId": "27343",
"signingGroupName": "TestSigningGrp",
"signingGroupUsers": [
{
"userName": "Test1",
"userId": "a832164e-0da7-449c-9405-be21632564a4",
"email": "email1#gmail.com",
"uri": "/users/a832164e-0da7-449c-9405-be21632564a4"
},
{
"userName": "Test2",
"userId": "68139c8e-8dee-4b51-8b78-842e470ee5b3",
"email": "email2#gmail.com",
"uri": "/users/68139c8e-8dee-4b51-8b78-842e470ee5b3"
}
],
"recipientId": "23764479",
"recipientIdGuid": "5474c7d9-1548-42a4-99ee-dba6ea87fdda",
"requireIdLookup": "false",
"routingOrder": "1",
"note": "",
"roleName": "SigningRole",
"status": "created",
"declinedReason": "",
"deliveryMethod": "email"
}
I've accepted as an answer the comment of #amit but the actual answer is the 8th comment of that answer, also by #amit.

Bot framework - Getting the user's answers from a form generated by json schema

I am using the function to BuildJsonForm to define a form using a JSON schema. I generate the JObject with some parameters the bot asks the user during runtime.
An example of the JObject/JSON I send to the function BuildJsonForm is this one:
`
{
"References": [
"Microsoft.Bot.Connector.dll",
"System.dll",
"mscorlib.dll",
"System.Net.Http.dll"
],
"Imports": [
"Microsoft.Bot.Connector.ThumbnailCard",
"Microsoft.Bot.Connector.StateClient",
"System.Net.Mail",
"System",
"System.Text.RegularExpressions",
"System.Net.Http",
"System.Net",
"System.Text"
],
"type": "object",
"required": [
"username",
"password"
],
"Templates": {
"NotUnderstood": {
"Patterns": [
"I do not understand, Please rephrase that"
]
},
"EnumSelectOne": {
"Patterns": [
"Choose one please"
],
"ChoiceStyle": "Auto"
}
},
"properties": {
"username": {
"Prompt": {
"Patterns": [
"Tell me the {&}, please",
"I need you to especify a {&}, please"
]
},
"type": [
"string",
"null"
],
"Templates": {
"NotUnderstood": {
"Patterns": [
"That is not a valid input"
]
}
}
},
"password": {
"Prompt": {
"Patterns": [
"Tell me the {&}, please",
"I need you to especify a {&}, please"
]
},
"type": [
"string",
"null"
],
"Templates": {
"NotUnderstood": {
"Patterns": [
"That is not a valid input"
]
}
}
}
},
"OnCompletion": "await context.PostAsync(\"Thank you!\"); string files = \"\"; context.PrivateConversationData.TryGetValue<string>(\"Files\", out files); [more code...]"
}
`
I need to send to the database the user's answers to the generated JObject/JSON form's questions, but so far, I haven't found a way to do that.
I also tried accessing the BotData with this line context.PrivateConversationData.TryGetValue<string>("Files", out files);, so I could send the user's answers to the database directly from the "OnCompletion" section of the JSON, but still I can't seem to access to the botdata or context on the OnCompletion section.
Is there any other way I can successfully retrieve the user's responses to the JObject/JSON generated form after the user answers the last question in the form?
It seemed that what was causing the trouble in my project were sending this parameters to the function:
GeneratedForm.BuildJsonForm(channel, user, convers);
since I edited the function without those parameters and I stopped getting the exception specified in the question. I will look for the reason these parameters were causing problems but the solution I found in this case was to define the funtction this way:
GeneratedForm.BuildJsonForm();

Get all information about Facebook posts including reactions

I'm having a problem with the URL of the Facebook Graph API. Is there any possibility to get all the fields of a Facebook post including reactions? I use the following URL for the posts:
https://graph.facebook.com/{pageName}/feed?access_token={access_token}
Now I'm getting data like this (which is quite nice):
{
"data": [
{
"id": "someId",
"from": {
"Name": "Page name",
"category": "Sports Team",
"id": "someId"
},
"message": "Hello world!",
[...]
"shares": {
"count": 1
},
"likes": {
"data": [
{
"id": "someId",
"name": "Some person"
}
]
}
},
[...]
]
}
As for now I have to get the reactions (LOVE, WOW, HAHA, SAD, ANGRY and THANKFUL) by downloading the json from the following URL for every single post (and this is very time consuming):
https://graph.facebook.com/v2.9/{postId}?access_token={access_token}&fields=reactions
The only problem is that I can't get the reactions when using the "normal" URL (without &fields). Is there any chance to get all information including reactions without having to add all the fields to &fields=from,message,likes,shares,reactions?
From CBroe's comment:
I had to pass all the fields I wanted to save to my DB in my URL:
https://graph.facebook.com/v2.9/{pageName}/feed?access_token={access_token}&fields=id,from,message,name,[...],likes,comments,reactions,shares

Categories

Resources