Ics file is "sending update" instead of creating a "send" - javascript

I have this meeting appointment i'm trying to send from an .ics file.
This is the data
"BEGIN:VCALENDAR\n" +
"CALSCALE:GREGORIAN\n" +
"METHOD:PUBLISH\n" +
"PRODID:-//Send project Invite//EN\n" +
"VERSION:2.0\n" +
"BEGIN:VEVENT\n" +
"UID:gestionprojetsCalendarInvite\n" +
"DTSTART;VALUE=DATE-TIME:" +
convertDate(startDate) +
"\n" +
"DTEND;VALUE=DATE-TIME:" +
convertDate(endDate) +
"\n" +
"SUMMARY:" +
subject +
"\n" +
"DESCRIPTION:" +
description +
"\n" +
"LOCATION:" +
location +
"\n" +
to.filter(o => o != '').map(o => "ATTENDEE;MAILTO:" + o.email).join("\n") +
"\n" +
"BEGIN:VALARM" +
"\n" +
"TRIGGER:-PT15M" +
"\n" +
"ACTION:DISPLAY" +
"\n" +
"DESCRIPTION:Reminder" +
"\n" +
"END:VALARM\n" +
"END:VEVENT\n" +
"END:VCALENDAR";
I want to know why, when I open the .ics file, it's saying "send update" instead of "send".
What I get :
What I want :

I believe it’s because you have static UID for all .ics you generated. "UID:gestionprojetsCalendarInvite\n"
UID aka unique ID, is supposed to uniquely represent a calendar event. When you open an ics file containing duplicated UID, your app (Outlook I guess?) thinks you want to update an existing event, not creating a new one.
Try give it a different UID to see if that solves your problem.
Ref: https://icalendar.org/New-Properties-for-iCalendar-RFC-7986/5-3-uid-property.html

Related

ICalendar add Attendees

I have this
let data =
"BEGIN:VCALENDAR\n" +
"CALSCALE:GREGORIAN\n" +
"METHOD:PUBLISH\n" +
"PRODID:-//Send project Invite//EN\n" +
"VERSION:2.0\n" +
"BEGIN:VEVENT\n" +
"UID:gestionprojectCalendarInvite\n" +
"DTSTART;VALUE=DATE-TIME:" +
convertDate(startDate) +
"\n" +
"DTEND;VALUE=DATE-TIME:" +
convertDate(endDate) +
"\n" +
"SUMMARY:" +
subject +
"\n" +
"DESCRIPTION:" +
description +
"\n" +
"LOCATION:" +
location +
"\n" +
"END:VEVENT\n" +
"END:VCALENDAR";
How can I add attendees to the data that is sent to the calendar event that i'm creating.
Here is the place where I need my info in :
I added
ATTENDEE;PARTSTAT=ACCEPTED;CN=NAME_OF_ATTENDEE:mailto:EMAIL_OF_ATTENDEE
Replace NAME_OF_ATTENDEE and EMAIL_OF_ATTENDEE with what you need.
This will put the correct information in the TO: box

Square POS API adding Unique ID, is it possible?

I am working with Square POS API and have successfully sent a request to the android app via a mobile web app. The app opens, displays the correct price, accepts payment and returns to the callback URL.
I have read over the documentation a few times and may be missing it but is there a way I can add a Unique ID that is sent to the app and returned to the callback page so I can update the correct line item in the database?
possibly something like:
"l.com.squareup.pos.UNIQUE_ID=" + unique_id + ";" +
var posUrl =
"intent:#Intent;" +
"action=com.squareup.pos.action.CHARGE;" +
"package=com.squareup;" +
"S.com.squareup.pos.WEB_CALLBACK_URI=" + callbackUrl + ";" +
"S.com.squareup.pos.CLIENT_ID=" + applicationId + ";" +
"S.com.squareup.pos.API_VERSION=" + sdkVersion + ";" +
"i.com.squareup.pos.TOTAL_AMOUNT=" + transactionTotal + ";" +
"S.com.squareup.pos.CURRENCY_CODE=" + currencyCode + ";" +
"S.com.squareup.pos.TENDER_TYPES=" + tenderTypes + ";" +
"l.com.squareup.pos.AUTO_RETURN_TIMEOUT_MS=" + callbacktime + ";" +
"l.com.squareup.pos.UNIQUE_ID=" + unique_id + ";" +
"end";

JavaScript blob encoding as UTF-8 instead of ANSI

I use a JavaScript blob to create an FDF file which opens & fills in a locally stored PDF.
However, the file path to the locally stored PDF contains an accented character (and I am unable to edit the folder name).
This code works when the folder path doesn’t contain an accent and if I open the fdf in Notepad, the default encoding is ANSI. But when the folder path contains an accent, the FDF opens to a message stating the PDF cannot be found. Furthermore, the default encoding in Notepad has changed to UTF-8.
FDF_Text = ''
+ '%FDF-1.2' + "\n"
+ '1 0 obj<</FDF<</F(T:/Échange/MY_PDF.pdf)/Fields 2 0 R>>>>' + "\n"
+ 'endobj' + "\n"
+ '2 0 obj[' + "\n"
+ '<</T(FIELD_NAME)/V(SOME_TEXT)>>' + "\n"
+ ']' + "\n"
+ 'endobj' + "\n"
+ 'trailer' + "\n"
+ '<</Root 1 0 R>>' + "\n"
+ '%%EO'
var blobObject = new Blob([FDF_Text], {type: 'text/css;charset=ANSI'});
window.navigator.msSaveOrOpenBlob(blobObject, 'MY_FDF.fdf');
I have tried
replacing É with E
using String.fromCharCode(201) (the chr value for É)
changing & removing the "type" of the blob itself to several different examples I've found (sorry I didn't keep track of all the different combinations).
Can anyone suggest a different solution?
You can represent the data as binary, just run through the string and fill a binary array
FDF_Text = ''
+ '%FDF-1.2' + "\n"
+ '1 0 obj<</FDF<</F(T:/Échange/MY_PDF.pdf)/Fields 2 0 R>>>>' + "\n"
+ 'endobj' + "\n"
+ '2 0 obj[' + "\n"
+ '<</T(FIELD_NAME)/V(SOME_TEXT)>>' + "\n"
+ ']' + "\n"
+ 'endobj' + "\n"
+ 'trailer' + "\n"
+ '<</Root 1 0 R>>' + "\n"
+ '%%EO'
var uint8 = new Uint8Array(FDF_Text.length);
for (var i = 0; i < uint8.length; i++){
uint8[i] = FDF_Text.charCodeAt(i);
}
var blobObject = new Blob([uint8], {type: 'text/fdf'});
window.navigator.msSaveOrOpenBlob(blobObject, 'MY_FDF.fdf');

Trying to inject datapoints into iOS webView using highcharts

While porting an android app to iOS we hit a barrier:
We have a UIwebView set up to run HighCharts (it works with their provided sample), but we can't figure out how to pass variables to Javascript in order to display real time changes.
The android-equivalent of what we're trying to do is:
webView.loadUrl("javascript:" + "point = " + "[Date.UTC("
+ mYear + "," + mMonth + "," + mDay + "," + hr
+ "," + min + "," + sec + "),"
+ value+ "];");
or another example:
webView.loadUrl("javascript:" + "var curve_name = " + "'Illuminance';" +
"var unit_of_meas = " + "'lx';" +
"var x_axis_title = " + "'Date';" +
"var y_axis_title = " + "'Illuminance (lx)';" +
"var plot_title = " + "'Illuminance data';" +
"var plot_subtitle = " + "'';")
UIWebView has a method called stringByEvaluatingJavaScriptFromString that you can use to run a script. I think that you can also use it to just pass and initialize any variable that you like.

Really detect Browser support Javascript by C#.NET 2.0 or higher?

I need to detect the Browser has support Javascript by C#.NET 2.0 code. But the Request.Browser.Javascript do not work correct now for all Browser.
I really need other way to detect it, who can tell me know also everyone here with the same problem.
Thanks :-)
Please use new HttpBrowserCapabilities().JavaScript instead
When you say C# .NET 2.0 code, are you referring to ASP.NET or Silverlight? I assume ASP.NET. Regardless, browser detection is a pretty unreliable source of information about the client's capabilities. What are you really trying to find out? If you need to ensure that the client has Javascript enabled, one method is to include html code like <noscript>This page requires javascript</noscript>. This is a pretty common way to provide fallback error information (ie that your code requires Javascript in order to work properly).
Check this link at Scott Hanselman blog, it describes the problem as you have suggested. And also check out this MSDN link.
Code sample from MSDN:
private void Button1_Click(object sender, System.EventArgs e)
{
System.Web.HttpBrowserCapabilities browser = Request.Browser;
string s = "Browser Capabilities\n"
+ "Type = " + browser.Type + "\n"
+ "Name = " + browser.Browser + "\n"
+ "Version = " + browser.Version + "\n"
+ "Major Version = " + browser.MajorVersion + "\n"
+ "Minor Version = " + browser.MinorVersion + "\n"
+ "Platform = " + browser.Platform + "\n"
+ "Is Beta = " + browser.Beta + "\n"
+ "Is Crawler = " + browser.Crawler + "\n"
+ "Is AOL = " + browser.AOL + "\n"
+ "Is Win16 = " + browser.Win16 + "\n"
+ "Is Win32 = " + browser.Win32 + "\n"
+ "Supports Frames = " + browser.Frames + "\n"
+ "Supports Tables = " + browser.Tables + "\n"
+ "Supports Cookies = " + browser.Cookies + "\n"
+ "Supports VBScript = " + browser.VBScript + "\n"
+ "Supports JavaScript = " +
browser.EcmaScriptVersion.ToString() + "\n"
+ "Supports Java Applets = " + browser.JavaApplets + "\n"
+ "Supports ActiveX Controls = " + browser.ActiveXControls
+ "\n"
+ "Supports JavaScript Version = " +
browser["JavaScriptVersion"] + "\n";
TextBox1.Text = s;
}
I strongly hope it solves your problem.

Categories

Resources