Using the google calendar API v3, I added an event to a google calendar. Now I want to built an html link so that someone can click and view the calendar event.
Here's what I have tried:
View Google
the href looks like:
https://www.google.com/calendar/feeds/default/private/full/bigstringhere1ovmuup7mjf0
Problem is I get a a 401 Error "Authorization Required"
How can I build a link to view/edit the calendar event based on a google calendar ID?
There is a way! To view a public calendar event, use a link of the form:
https://www.google.com/calendar/event?eid={event-id}&ctz={timezone}
where {event-id} is the unique event id, and {timezone} is one of these time zones.
Here's an example: link to a specific public calendar event.
If you have editing rights to the calendar this event is from, you will be able to edit the event and see the guest list. Otherwise, you just see the public information about the event.
Since it can be difficult to determine the event id, here's a bookmarklet that produces a link to your Google Calendar event when you are editing its Details page:
javascript:(function(){ try { window.prompt('Shareable link to this event:','https://www.google.com/calendar/event?eid='+document.getElementsByClassName('ep')[0].getAttribute('data-eid')) } catch (e) {alert("Use this bookmarklet to get a shareable link to a Google Calendar event when editing its Details page.")}})()
And a version of this bookmarklet which works with the new (as of 2017) Google Calendar UI:
javascript:(function(){
window.prompt('Shareable link to this event:',
'https://www.google.com/calendar/event?eid='+
window.location.href.split("/").pop().split("?")[0])
})()
(Also possibly useful, how to link to a specific day of a public Google calendar:
https://www.google.com/calendar/embed?src={calendar-id}&mode=day&dates={yyyymmdd}%2F{yyyymmdd}
where {calendar-id} is the calendar's id and {yyyymmdd} is the day you want to link to.
Optional parameters include the time zone and whether to display various items, for example:
&ctz=Asia/Taipei&showNav=0&showPrint=0&showCalendars=0
Example: link to single day of a public calendar.)
Here is the HTML to build the link:
https://www.google.com/calendar/render?action=TEMPLATE&text=Your+Event+Name&dates=20140127T224000Z/20140320T221500Z&details=For+details,+link+here:+http://www.example.com&location=Waldorf+Astoria,+301+Park+Ave+,+New+York,+NY+10022&sf=true&output=xml
Event URL is not calendar URL.
This link brings explanations: Google Calender v3
And the way to build this url is:
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
where calendarId & eventId are parametres.
Hope this is helpfull.
I wanted to post this because it is tangental to the question being asked and this post comes up when I was trying to do the following.
I was trying to generate a Google Event for the sole purpose of being added to other people's calendars, not saved to any particular calendar. I've found an example here and I'm currently trying to figure out the URL params it accepts.
https://www.google.com/calendar/render?action=TEMPLATE&text=PRP+Due&dates=20141106T120000Z/20141106T120000Z&details&location&trp=false
To view Google calender event by event Id.
You can use below example:
https://www.google.com/calendar/event?eid={event-id}&ctz={timezone}
Example For Indian TimeZone :
https://calendar.google.com/calendar/event?eid=ZjVicWczYWpndmh0ZmdtYmd0cXFxZWc3czggdTJoZmoybGg0aDcwbmhzMzV2c25pamd1dG9AZw&ctz=Asia/Kolkata
To create a page where users can view the Calendar of Events publicly, a user who has permissions to change calendar sharing settings must first make the calendar public:
From the Google Calendar, at the top right, click the Settings wheel.
In Settings, click the "Calendars" tab.
Click the name of the Calendar you're working with.
Next, click the "Share this Calendar" tab. Make sure the checkboxes are checked from the screenshot below (circled in red).
Afterwards, click the "Calendar Details" tab, located at the top left.
Scroll down to the "Calendar address" section, as shown in the screenshot below.
Click "HTML".
A popup modal will appear, which includes the public URL you'll need to access the Calendar publicly.
Here is an example of what the URL might look like:
https://www.google.com/calendar/embed?src=domain.comrandomstring#group.calendar.google.com&ctz=America/Los_Angeles&gsessionid=OK
In addition, see the Google Calendar Data API for information on creating and working with Calendar Gadgets.
To get the event from the Google Calendar API v3, call:
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
The event contains a property htmlLink, which is exactly what you need:
An absolute link to this event in the Google Calendar Web UI. Read-only.
See https://developers.google.com/google-apps/calendar/v3/reference/events.
The link looks like this:
https://www.google.com/calendar/event?eid=XzYwcTMwYzFnNjBvMzBlMWk2MG80YWMxZzYwcmo4Z3BsODhyajJjMWg4NHMzNGg5ZzYwczMwYzFnNjBvMzBjMWc2c28zMmRoaDhwMGpnaDIxNnQyNDZkaGc2NG8zMGMxZzYwbzMwYzFnNjBvMzBjMWc2MG8zMmMxZzYwbzMwYzFnNzByNDRoMWk2b3AzOGUxazZoMms2aDFrNmQwamNkaTI2OHBrMmhpMjg4czRjZ2hoNzBwMF8yMDA2MDUwNSBob3BtYW4ubmxfbjE5ZGF2YWgxb3Zkb3EzbGl2N2t1aWU5Z.
It will open the event full screen, only of course if you have access to the event. The screen will contain a back button to go back to the calendar.
Clearly, you can't construct this link yourself so you will need to do a call to the API, but you are probably already doing that anyway.
When an google calendar event created, then in the response we got result property. In this result property, one more htmlLink would be available which have link regarding the event being created. Now, it can opened :
window.open(response.result.htmlLink, '_target');
Wordpress + ACF google cal.
Set your ACF date picker to custom return Y-m-d g:i a
Then create a google formatted date.
$event_start_date = get_field('event_start_date');
$event_print_date = date('d/m/Y',strtotime($event_start_date));
$event_start_time = get_field('event_start_time');
$event_end_date = get_field('event_end_date');
$event_print_enddate = date('d/m/Y',strtotime($event_end_date));
$event_end_time = get_field('event_end_time');
$calendarDate = date('Ymd',strtotime($event_start_date)) .'T'. date('Hi',strtotime($event_start_time)). '00/' . date('Ymd',strtotime($event_end_date)) .'T'. date('Hi',strtotime($event_end_time)) . '00';
Link
Add this event to my Google Calendar
private string GetEventLink(string calendarId, string eventId)
{
var calendarIdToEncode = calendarId.Substring(0, calendarId.IndexOf("#", StringComparison.Ordinal) + 2);
var eId = Convert.ToBase64String(Encoding.UTF8.GetBytes(eventId + " " + calendarIdToEncode));
return $"https://www.google.com/calendar/event?eid={eId.Substring(0, eId.Length - 2)}";
}
Google Have created a page to DIY.
https://support.google.com/calendar/answer/3033039
Related
I have a webview inside my application and when an external link is clicked (that in normal browser is open in a new tab), I can't then go back to my website.
It is possible when a new tab is open to have the menu closed that tab like Gmail do ?
The objective is that, whenever a link is clicked, the user would have the choice to choose which option to view the content with, e.g. Clicking a link would suggest open youtube app or google chrome. The purpose is to appear the google chrome option
Or what suggestions do you have to handle this situation ?
If I understood you correctly, you want to have the option to select how to open the web link - inside your app, or within another app's (browser) context.
If this is correct, then you can use Xamarin.Essentials: Browser functionality.
public async Task OpenBrowser(Uri uri)
{
await Browser.OpenAsync(uri, BrowserLaunchMode.SystemPreferred);
}
Here the important property is the BrowserLaunchMode flag, which you can learn more about here
Basically, you have 2 options - External & SystemPreferred.
The first one is clear, I think - it will open the link in an external browser.
The second options takes advantage of Android's Chrome Custom Tabs & for iOS - SFSafariViewController
P.S. You can also customise the PreferredToolbarColor, TitleMode, etc.
Edit: Based from your feedback in the comments, you want to control how to open href links from your website.
If I understood correctly, you want the first time that you open your site, to not have the nav bar at the top, and after that to have it. Unfortunately, this is not possible.
You can have the opposite behaviour achieved - the first time that you open a website, to have the nav bar and if the user clicks on any link, to open it externally (inside a browser). You have 2 options for this:
To do it from your website - change the a tag's target to be _blank like this;
To do it from your mobile app - create a Custom renderer for the WebView. In the Android project's renderer implementation, change the Control's WebViewClient like so:
public class CustomWebViewClient : WebViewClient
{
public override bool ShouldOverrideUrlLoading(Android.Webkit.WebView view, IWebResourceRequest request)
{
Intent intent = new Intent(Intent.ActionView, request.Url);
CrossCurrentActivity.Current.StartActivity(intent);
return true;
}
}
I have two tabs in my personal msteams application and I would like to navigate between them dynamically. Is it possible? I've tried to use microsoftTeams.getTabInstances method from msteams SDK to get my tabs and after that navigate to the chosen tab by invoking microsoftTeams.navigateToTab but this approach doesn't work - I get null from microsoftTeams.getTabInstances. My user is logged in (I've read somewhere that user must be logged in).
I've not tried exactly this action, but I believe you should be able to do what you're trying using Deep Links. In particular, see the Deep linking from your tab where it talks about
This is useful if your tab needs to link to [...] another tab [...]
and the syntax is
microsoftTeams.executeDeepLink(/*deepLink*/);
Just a reminder that in deep link syntax, e.g. https://teams.microsoft.com/l/entity/<appId>/<entityId>, the appid is your Teams app id, and the "entityId" must match the "entityId" for your tab in your Teams manifest file.
You can deeplink to content in Teams from your tab. This is useful if your tab needs to link to other content in Teams such as to a channel, message, another tab or even to open a scheduling dialog. To trigger a deeplink from your tab you should call:
var encodedWebUrl = encodeURI('https://tasklist.example.com/123/456&label=Task 456');
var encodedContext = encodeURI('{"subEntityId": "task456"}');
var taskItemUrl = 'https://teams.microsoft.com/l/entity/fe4a8eba-2a31-4737-8e33-e5fae6fee194/tasklist123?webUrl=' + encodedWebUrl + '&context=' + encodedContext;
Please take a look Deep Link to your tab
The Hangout API at https://developers.google.com/+/hangouts/writing includes an example to set a callback function when the hangout state has changed, like this:
gapi.hangout.onStateChanged.add(onStateChange);
When run, this results in an error similar to "gapi.hangout.onStateChanged is undefined". A quick check in Firebug shows that the onStateChanged method belongs to gapi.hangout.data not gapi.hangout.
What is the correct way to add a callback function when the state has changed?
The method that you're looking for is indeed a member of gapi.hangout.data. The writing article you mention seems to be out of date. I fix it :)
To do something when state changes just attach a callback:
gapi.hangout.data.onStateChanged.add(function() {
console.log(gapi.hangout.data.getState());
});
You can find working examples of the code in action on the sample apps page.
I have submited a App but is not certified because this:
"This application uses the Location Service API to determine a user's location and show them events taking place nearby
however, it does not appear to contain a privacy policy that is accessible to users explaining how the application uses the
Location Service API."
And what i want to do is something like this
When user clicks in Policty Statement open a new window with settings page with my app location policies.
Can anyone help me? How can i add a link like in image?
Cumps
You can navigate to a page using the Hyperlink control
<Textblock>
<Hyperlink NavigateUri="/PrivacyPage.xaml"
TargetName="_blank">Privacy Statement</Hyperlink>
</Textblock>
See MSDN for more info
I don't think you can put a hyperlink in a call to MessageBox.Show() though so you have to create your own Messagebox-like page.
The first time the app is launched you direct the user to your message page. E.g. using this in MainPage.xaml
OnNavigatedTo(...)
{
if(!AppSettings.HasMessageBeenShown)
{
AppSettings.HasMessageBeenShown=true;
NavigationContext.Navigate(new Uri("/MessagePage.xaml", UriKind.Relative));
}
}
I'm making an app and I want to be able to go from my app to the messaging app straight to the "Create new" page. Is there a way I can navigate to that page straight from my app?
As Andrew M mentioned, the SmsComposeTask is the correct control to use. Here is some sample code for you:
SmsComposeTask smsTask = new SmsComposeTask();
smsTask.To = "0123456789"; // the number you would like to send the sms to
smsTask.Body = "Some prefilled text..."; // if you would like to fill some text
smsTask.Show();
When Show() is called, the app will navigate to the Messaging application and display an SMS filled in with the defined parameters.
Simply use the above code in an event handler (i.e., the event for when a button is clicked), and the user will be navigated accordingly.
Use the SMSComposeTask:
http://www.nickharris.net/2010/09/how-to-sms-using-the-smscomposetask-for-windows-phone-7/