builder.append("BEGIN:VCALENDAR\n" +
"METHOD:REQUEST\n" +
"PRODID:Microsoft Exchange Server 2010\n" +
"VERSION:2.0\n" +
"BEGIN:VTIMEZONE\n" +
"TZID:Eastern Time\n" +
"END:VTIMEZONE\n" +
"BEGIN:VEVENT\n" +
"ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:" + calendarRequest.getToEmail() + "\n" +
"ORGANIZER;CN=ORGANIZER:MAILTO:" + fromEmail + "\n" +
"DESCRIPTION;LANGUAGE=en-US:" + calendarRequest.getBody() + "\n" +
"UID:"+calendarRequest.getUid()+"\n" +
"SUMMARY;LANGUAGE=en-US:Discussion\n" +
"DTSTART:" + formatter.format(MeetingStartTime).replace(" ", "T") + "\n" +
"DTEND:" + formatter.format(MeetingEndTime).replace(" ", "T") + "\n" +
"CLASS:PUBLIC\n" +
"PRIORITY:5\n" +
"DTSTAMP:20200922T105302Z\n" +
"TRANSP:OPAQUE\n" +
"STATUS:CONFIRMED\n" +
"SEQUENCE:$sequenceNumber\n" +
"LOCATION;LANGUAGE=en-US:Microsoft Teams Meeting\n" +
"BEGIN:VALARM\n" +
"DESCRIPTION:REMINDER\n" +
"TRIGGER;RELATED=START:-PT15M\n" +
"ACTION:DISPLAY\n" +
"END:VALARM\n" +
"END:VEVENT\n" +
"END:VCALENDAR");
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setHeader("Content-Class", "urn:content-classes:calendarmessage");
messageBodyPart.setHeader("Content-ID", "calendar_message");
messageBodyPart.setDataHandler(new DataHandler(
new ByteArrayDataSource(builder.toString(), "text/calendar;method=REQUEST;name=\"invite.ics\"")));
Here I am trying to send an outlook invitation through java code it's showing an error "not supported invite.ics".
I have checked form and organizer email both are same.
I am using outlook 2016.
Related
I'm developing an app with Tradingview widget on Android 6.0 (Marshmallow)
I am running the tradingview code in WebView but it is not showing the chart.
This is my TradingView Widget code;
WebView webView = findViewById(R.id.webviewer);
String symbol = getIntent().getStringExtra("symbol");
String interval = getIntent().getStringExtra("interval");
String data = "<!-- TradingView Widget BEGIN -->\n" +
"<div class=\"tradingview-widget-container\">\n" +
" <div id=\"tradingview_357eb\"></div>\n" +
" <div class=\"tradingview-widget-copyright\"><span class=\"blue-text\">"+symbol+" Chart</span></div>\n" +
" <script type=\"text/javascript\" src=\"https://s3.tradingview.com/tv.js\"></script>\n" +
" <script type=\"text/javascript\">\n" +
" new TradingView.widget(\n" +
" {\n" +
" \"width\": 300,\n" +
" \"height\": 200,\n" +
" \"symbol\": \"BINANCE:"+symbol+"\",\n" +
" \"interval\": \""+interval+"\",\n" +
" \"timezone\": \"Europe/Istanbul\",\n" +
" \"theme\": \"light\",\n" +
" \"style\": \"1\",\n" +
" \"locale\": \"en\",\n" +
" \"toolbar_bg\": \"#f1f3f6\",\n" +
" \"enable_publishing\": false,\n" +
" \"hide_side_toolbar\": false,\n" +
" \"save_image\": false,\n" +
" \"studies\": [\n" +
" \"BB#tv-basicstudies\",\n" +
" \"RSI#tv-basicstudies\",\n" +
" \"StochasticRSI#tv-basicstudies\"\n" +
" ],\n" +
" \"container_id\": \"tradingview_357eb\"\n" +
"}\n" +
" );\n" +
" </script>\n" +
"</div>\n" +
"<!-- TradingView Widget END -->";
webView.getSettings().setJavaScriptEnabled(true);
webView.loadData(data, "text/html", "utf-8");
I tried it on Android 8.0 and it works but not on 6.0. Why? Am I missing something?
I created an app that uses Leaflet in it.
In the screen where the map is, there is also a progressBar where I allow uses to search in a specific radius.
The moment they change the value in the progressBar, it changes the size of the circle marker inside the map.
I had like that my map will change its zoom to fit that circle in it.
My code for loading the map is:
String Map_HTML = "<html>\n" +
"<head>\n" +
"\n" +
" <title>Quick Start - Leaflet</title>\n" +
"\n" +
" <meta charset=\"utf-8\" />\n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" +
"\n" +
" <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"docs/images/favicon.ico\" />\n" +
"\n" +
" <link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet#1.4.0/dist/leaflet.css\" integrity=\"sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==\" crossorigin=\"\"/>\n" +
" <script src=\"https://unpkg.com/leaflet#1.4.0/dist/leaflet.js\" integrity=\"sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==\" crossorigin=\"\"></script>\n" +
"\n" +
"\n" +
"\n" +
"<style>\n" +
"body {\n" +
"padding: 0;\n" +
"margin: 0;\n" +
"}\n" +
"html, body, #map {\n" +
"height: 100%;\n" +
"width: 100%;\n" +
"}\n" +
"</style>\n" +
"</head>\n" +
"<body>\n" +
"\n" +
"\n" +
"\n" +
"<div id=\"mapid\" style=\"width: " + dpWidth + "px; height: " + dpHeight * 0.3 + "px;\"></div>\n" +
"<script>\n" +
"\n" +
"var mymap = L.map('mapid',{zoomControl: false}).setView([" + Lat + ", " + Lon + "], 10);\n" +
"\n" +
" L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n" +
" minZoom: 7,\n" +
" maxZoom: 17,\n" +
" attribution: '© OpenStreetMap contributors' \n" +
" }).addTo(mymap);\n" +
"\n" +
"mymap.attributionControl.setPosition('topleft')\n" +
"L.control.zoom({\n" +
"position: 'bottomright'\n" +
"}).addTo(mymap);\n" +
"L.marker([" + Lat + ", " + Lon + "]).addTo(mymap)\n" +
" .bindPopup(\"<b>My Location</b>\").openPopup();\n" +
"\n" +
"L.circle([" + Lat + ", " + Lon + "], " + Radius + ", {\n" +
" color: 'red',\n" +
" fillColor: '#8275FE',\n" +
" fillOpacity: 0.4,\n" +
" weight: '0'\n" +
"}).addTo(mymap);\n" +
"\n" +
"\n" +
"var popup = L.popup();\n" +
"\n" +
"</script>\n" +
"\n" +
"</body>\n" +
"</html>";
where Radius is a parameter I insert based on the value of the progressBar.
Right now it always initializes the map with zoom: 10 because I don't know how to change it dynamically as I want.
Any way to do so?
Thank you
the map can fit to the bounds of the circle with mymap.fitBounds(circle.getBounds());.
Change your code to:
"var circle = L.circle([" + Lat + ", " + Lon + "], " + Radius + ", {\n" +
" color: 'red',\n" +
" fillColor: '#8275FE',\n" +
" fillOpacity: 0.4,\n" +
" weight: '0'\n" +
"}).addTo(mymap);\n" +
"mymap.fitBounds(circle.getBounds());\n" +
I have the following data, which is a list of lists:
"segmentation": [[239.97,260.24,222.04,270.49,199.84,253.41,213.5,227.79,259.62,200.46,274.13,202.17,277.55,210.71,249.37,253.41,237.41,264.51,242.54,261.95,228.87,271.34]]
What I need to do is to parse the information to a JSON object without removing the second braces.
I tried it with Jackson, but this fails with any data types.
Do you have any idea how to handle this?
Parse to JsonNode will work. I think u try with invalid json. check:
String value = "{\n" +
" \"segmentation\": [\n" +
" [\n" +
" 239.97,\n" +
" 260.24,\n" +
" 222.04,\n" +
" 270.49,\n" +
" 199.84,\n" +
" 253.41,\n" +
" 213.5,\n" +
" 227.79,\n" +
" 259.62,\n" +
" 200.46,\n" +
" 274.13,\n" +
" 202.17,\n" +
" 277.55,\n" +
" 210.71,\n" +
" 249.37,\n" +
" 253.41,\n" +
" 237.41,\n" +
" 264.51,\n" +
" 242.54,\n" +
" 261.95,\n" +
" 228.87,\n" +
" 271.34\n" +
" ]\n" +
" ]\n" +
"}";
JsonNode jsonNode = new ObjectMapper().readTree(value);
I got request token (oauth_token and oauth_token_secret) using https://www.tumblr.com/oauth/request_token this URL.
Then I constructed authorize URL using oauth_token which I got in the previous step.
When I try to get access token using my app consumerKey, consumerSecret, and oauth_token , oauth_token_secret, getting
"oauth_signature does not match expected value" error message.
Message constructed for HmacSHA1,
String signatureBaseString = "GET&" + URLEncoder.encode(accessURL, "UTF-8") + "&" + "oauth_callback%3D" + URLEncoder.encode(URLEncoder.encode(redirectUrl, "UTF-8"), "UTF-8") + "%26oauth_consumer_key%3D" + URLEncoder.encode(consumerKey, "UTF-8") + "%26oauth_nonce%3D" + URLEncoder.encode(String.valueOf(millis), "UTF-8") + "%26oauth_signature_method%3D" + URLEncoder.encode("HMAC-SHA1", "UTF-8") + "%26oauth_token%3D" + URLEncoder.encode(oauthToken, "UTF-8") + "%26oauth_timestamp%3D" + URLEncoder.encode(String.valueOf(time), "UTF-8") + "%26oauth_token_secret%3D" + URLEncoder.encode(oauthTokenSecret, "UTF-8") + "%26oauth_version%3D" + URLEncoder.encode("1.0", "UTF-8") + "%oauth_verifier%3D" + verifier;
Header constructed to get access token using request token,
String accessHeader = "OAuth " + "oauth_callback=\"" + URLEncoder.encode(redirectUrl, "UTF-8") + "\"" + ", oauth_consumer_key=\"" + URLEncoder.encode(consumerKey, "UTF-8") + "\"" + ", oauth_nonce=\"" + URLEncoder.encode(String.valueOf(millis), "UTF-8") + "\"" + ", oauth_signature=\"" + URLEncoder.encode(signature, "UTF-8") + "\"" + ", oauth_signature_method=\"" + URLEncoder.encode("HMAC-SHA1", "UTF-8") + "\"" + ",oauth_token=\"" + URLEncoder.encode(oauthToken, "UTF-8") + "\"" + ", oauth_timestamp=\"" + URLEncoder.encode(String.valueOf(time), "UTF-8") + ",oauth_token_secret=\"" + URLEncoder.encode(oauthTokenSecret, "UTF-8") + "\"" + ", oauth_version=\"" + URLEncoder.encode("1.0", "UTF-8") + "\"" + ", oauth_verifier=\"" + verifier + "\"";
Can anyone please help me to solve this?
String textEmail= "Hi, \n this is an automatic message \n from sender.
StringBuffer buffer = sb.append("BEGIN:VCALENDAR\n" +
"PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN\n" +
"VERSION:2.0\n" +
"METHOD:REQUEST\n" +
"BEGIN:VEVENT\n" +
"ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:" +emailAdressTo+"\n" +
"ORGANIZER:MAILTO:XX#gmail.com\n" +
"DTSTART:" + meetingStartTime + "\n"+
"DTEND:" + meetingEndTime + "\n"+
"LOCATION: Room FR PAR-New York\n" +
"TRANSP:OPAQUE\n" +
"SEQUENCE:0\n" +
"UID:"+ uniqueId +"\n" +
"DTSTAMP:"+ meetingEndTime + "\n" +
"CATEGORIES:Meeting\n" +
"DESCRIPTION:"+textEmail +"\n" +
"SUMMARY:"+subjectEmail+"\n" +
"PRIORITY:5\n" +
"CLASS:PUBLIC\n" +
"BEGIN:VALARM\n" +
"TRIGGER:PT1440M\n" +
"ACTION:DISPLAY\n" +
"DESCRIPTION:Reminder\n" +
"END:VALARM\n" +
"END:VEVENT\n" +
"END:VCALENDAR");
email.setContent(buffer.toString(),"text/calendar");
email.setCharset("UTF-8");
the linebreaks breaks are not taken in consideration and my output is just:
"Hi,this is an automatic message from sender"
I have tried every think in this post:
[1]How do I format a String in an email so Outlook will print the line breaks? but still same result Any help would be apreciated, thks
List item