Is there a way, in Microsoft Graph API, using singleValueExtendedProperties or multiValueExtendedProperties, to send an email with voting options?
I can do it with using Microsoft.Exchange.WebServices and the following code, but I need a way to do it in Microsoft Graph API
public byte[] StringToByteArray(string hex)
{
if (hex.Length % 2 == 1)
throw new Exception("The binary key cannot have an odd number of digits");
byte[] arr = new byte[hex.Length >> 1];
for (int i = 0; i < hex.Length >> 1; ++i)
{
arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + (GetHexVal(hex[(i << 1) + 1])));
}
return arr;
}
public int GetHexVal(char hex)
{
int val = (int)hex;
//For uppercase A-F letters:
//return val - (val < 58 ? 48 : 55);
//For lowercase a-f letters:
//return val - (val < 58 ? 48 : 87);
//Or the two combined, but a bit slower:
return val - (val < 58 ? 48 : (val < 97 ? 55 : 87));
}
public void TestEmail()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new WebCredentials("xxxxxx#xxxxxx.xxx", "xxxxxxxxx");
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
EmailMessage email = new EmailMessage(service);
email.ToRecipients.Add("xxx#xxxxxxx.xxx");
email.Subject = "Approval test from C#";
email.ReplyTo.Add("xxx#xxxxxxx.xxx");
string Header = "02010600000000000000";
string ReplyToAllHeader = "055265706C790849504D2E4E6F7465074D657373616765025245050000000000000000";
string ReplyToAllFooter = "0000000000000002000000660000000200000001000000";
string ReplyToHeader = "0C5265706C7920746F20416C6C0849504D2E4E6F7465074D657373616765025245050000000000000000";
string ReplyToFooter = "0000000000000002000000670000000300000002000000";
string ForwardHeader = "07466F72776172640849504D2E4E6F7465074D657373616765024657050000000000000000";
string ForwardFooter = "0000000000000002000000680000000400000003000000";
string ReplyToFolderHeader = "0F5265706C7920746F20466F6C6465720849504D2E506F737404506F737400050000000000000000";
string ReplyToFolderFooter = "00000000000000020000006C00000008000000";
string ApproveOption = "0400000007417070726F76650849504D2E4E6F74650007417070726F766500000000000000000001000000020000000200000001000000FFFFFFFF";
string RejectOtion = "040000000652656A6563740849504D2E4E6F7465000652656A65637400000000000000000001000000020000000200000002000000FFFFFFFF";
string VoteOptionExtras = "0401055200650070006C00790002520045000C5200650070006C007900200074006F00200041006C006C0002520045000746006F007200770061007200640002460057000F5200650070006C007900200074006F00200046006F006C00640065007200000741007000700072006F00760065000741007000700072006F007600650006520065006A0065006300740006520065006A00650063007400";
string DisableReplyAllVal = "00";
string DisableReplyVal = "00";
string DisableForwardVal = "00";
string DisableReplyToFolderVal = "00";
email.Body = new MessageBody();
email.Body.BodyType = BodyType.HTML;
email.Body.Text = "Body";
ExtendedPropertyDefinition VOTE_DEF = new ExtendedPropertyDefinition(Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet.Common, 0x8520, Microsoft.Exchange.WebServices.Data.MapiPropertyType.Binary);
byte[] bytes = StringToByteArray(Header + ReplyToAllHeader + DisableReplyAllVal + ReplyToAllFooter + ReplyToHeader + DisableReplyVal + ReplyToFooter + ForwardHeader + DisableForwardVal + ForwardFooter + ReplyToFolderHeader + DisableReplyToFolderVal + ReplyToFolderFooter + ApproveOption + RejectOtion + VoteOptionExtras);
email.SetExtendedProperty(VOTE_DEF, bytes);
email.SendAndSaveCopy();
}
Yes using EWS API you can do this. But i failed to notice any documentation how to do so. Being said that i remember a related thread talks about this and see how you can use MAPI extended properties. If nothing works, consider filing an uservoice item(feature request) with Microsoft Graph team, so that they can consider implementing it.
I'm writing a script that does the following :
send an email with an attachment (eg proof of payment) to people that register for our event when two criteria are met: payment has been processed, and if they have not yet received their proof of payment
make a copy of an existing file, using some variables in the new copy (this works fine) to personalize the proof of payment.
The copy of the file gets a new name (personalized).
I seem to be unable to make the script check correctly if the file already exists or not.
Who can help me out ?
function createDocument(e) {
var headers = Sheets.Spreadsheets.Values.get('SHEET ID', 'Lijst!A1:G');
var lid = Sheets.Spreadsheets.Values.get('SHEET ID', 'Lijst!A2:G');
var templateId = 'TEMPLATE ID';
for (var j = 0; j < lid.values.length; j++) {
if (lid.values[j][6] == 'ok' && lid.values[j][7] != 'Bewijs Verzonden') {
//collect the data from the member
var voornaam = lid.values[j][0];
var familienaam = lid.values[j][1];
var email = lid.values[j][2];
var aantal = lid.values[j][3];
var betaaldop = lid.values[j][5];
//Make a copy of the template file
var documentId = DriveApp.getFileById(templateId).makeCopy().getId();
var doc = DriveApp.getFileById(documentId);
var docname = 'Betalingsbewijs Reunie 2019 voor ' + familienaam + ' ' + voornaam + '.pdf';
//var filecheck = DriveApp.getFolderById('FOLDER ID');
var filecheck = DriveApp.getFilesByName(docname);
if (filecheck.hasNext()) {
Logger.log("No File Found");
} else {
//Get the document body as a variable
var body = DocumentApp.openById(documentId).getBody();
//Insert the data from spreadsheet
body.replaceText('<<Voornaam>>', voornaam)
body.replaceText('<<Naam>>', familienaam)
body.replaceText('<<Aantal deelnemers>>', aantal)
body.replaceText('<<Betaald op>>', betaaldop)
DocumentApp.openById(documentId).saveAndClose();
//move file to new folder and remove from parent folder
var file = DriveApp.getFileById(documentId);
file.getParents().next().removeFile(file);
DriveApp.getFolderById('FOLDER ID').addFile(file);
var pdfname = file.setName('Betalingsbewijs Reunie 2019 voor ' + familienaam + ' ' + voornaam + '.pdf');
var steil = "email#gmail.com";
var blob = pdfname.getBlob().getAs('application/pdf');
var subject = 'Betalingsbewijs Reunie 2019 voor ' + familienaam + ' ' + voornaam + ' met ' + aantal + 'deelnemer(s)';
var htmlBody =
"Beste " + voornaam + ", " +
"<br/>" +
"<br/>" +
"<br/>Bedankt voor uw inschrijving voor de Steil reünie op zaterdag 26 januari 2019." +
"<br/>Wij hebben uw betaling goed ontvangen." +
"<br/>Uw deelname aan de reünie is nu definitief in orde." +
"<br/>In bijlage kan u uw betalingsbewijs terugvinden in pdf." +
"<br/><br/>Indien u nog vragen heeft kan u ons steeds bereiken via reunie.steil#gmail.com." +
"<br/>Met verplegende groeten," +
"<br/>Het Steil Reünie team";
var optAdvancedArgs = {
name: "Steil Reünie 2019",
htmlBody: htmlBody,
replyTo: email,
cc: steil,
attachments: [blob]
};
GmailApp.sendEmail(email, subject, body, optAdvancedArgs);
var ConfirmationRange = "Lijst!H" + [j + 2];
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(ConfirmationRange).setValue('Bewijs Verzonden');
}
}
}
}
I have a task to make a syncing service that can sync the sales records present in the Quick books point of sale into the local database.
How to integrate Quick books desktop point of sale and web application(c#) via web connector?
Code used :
public string sendRequestXML(string ticket, string strHCPResponse, string
strCompanyFileName,
string qbXMLCountry, int qbXMLMajorVers, int qbXMLMinorVers) {
if (Session["counter"] == null) {
Session["counter"] = 0;
}
string evLogTxt="WebMethod: sendRequestXML() has been called by
QBWebconnector" + "\r\n\r\n";
evLogTxt=evLogTxt+"Parameters received:\r\n";
evLogTxt=evLogTxt+"string ticket = " + ticket + "\r\n";
evLogTxt=evLogTxt+"string strHCPResponse = " + strHCPResponse +
"\r\n";
evLogTxt=evLogTxt+"string strCompanyFileName = " +
strCompanyFileName + "\r\n";
evLogTxt=evLogTxt+"string qbXMLCountry = " + qbXMLCountry + "\r\n";
evLogTxt=evLogTxt+"int qbXMLMajorVers = " +
qbXMLMajorVers.ToString() + "\r\n";
evLogTxt=evLogTxt+"int qbXMLMinorVers = " +
qbXMLMinorVers.ToString() + "\r\n";
evLogTxt=evLogTxt+"\r\n";
ArrayList req=buildRequest();
string request="";
int total = req.Count;
count=Convert.ToInt32(Session["counter"]);
if(count<total) {
request=req[count].ToString();
evLogTxt=evLogTxt+ "sending request no = " + (count+1) + "\r\n";
Session["counter"] = ((int) Session["counter"]) + 1;
}
else{
count=0;
Session["counter"]=0;
request="";
}
evLogTxt=evLogTxt+"\r\n";
evLogTxt=evLogTxt+"Return values: " + "\r\n";
evLogTxt=evLogTxt+"string request = " + request + "\r\n";
logEvent(evLogTxt);
return request;
}
It is creating log in the end, how will i fetch the data from the QBPOS?
This ActionScript code I have been working on for a few days now works 100% just fine in JavaScript, but when I try to compile it in ActionScript it says I have unexpected /, ), and } symbols. Is this syntax wrong and if so how should I fix it? I figured I could test it as Javascript for quicker testing using http://jsfiddle.net/ but now I'm like =(
var txt = "This is a [rainbow]test to show that I can[/rainbow] make whatever I want [rainbow]appear as a rainbow[/rainbow] because I am [rainbow]awesome[/rainbow].";
if ((txt.indexOf("[rainbow]") > -1) && (txt.indexOf("[/rainbow]") > -1)) {
var colors = ['f0f', 'f0c', 'f09', 'f06', 'f03', 'f00', 'f30', 'f60', 'f90', 'fc0', 'ff0', 'cf0', '9f0', '6f0', '3f0', '0f0', '0f3', '0f6', '0f9', '0fc', '0ff', '0cf', '09f', '06f', '03f', '00f', '30f', '60f', '90f', 'c0f'];
function rainbowify(text) {
return text.replace(/\[rainbow\](.+?)\[\/rainbow\]/g, function(_, inner) {
return inner.replace(/./g, function(ch, i) {
return '<font color="#' + colors[i % colors.length] + '">' + ch + '</font>';
});
})
}
txt = rainbowify(txt);
document.write(txt);
}
Well, this is it:
txt = txt.replace("'", "#");
if ((txt.indexOf("[rainbow]") > -1) && (txt.indexOf("[/rainbow]") > -1)) {
var firstChar = txt.indexOf("[rainbow]") + 9;
var lastChar = txt.indexOf("[/rainbow]");
while (lastChar <= txt.lastIndexOf("[/rainbow]")) {
var RAINBOWTEXT = '';
var i = firstChar;
while (i < lastChar) {
RAINBOWTEXT += txt.charAt(i);
i++
}
var text = RAINBOWTEXT;
var texty = '';
colors = new Array('ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','66ff00','33ff00','00ff00','00ff33','00ff66','00ff99','00ffcc','00ffff','00ccff','0099ff','0066ff','0033ff','0000ff','3300ff','6600ff','9900ff','cc00ff');
i = 0;
while (i <= text.length) {
var t = text.charAt(i);
if (t != undefined) {
texty += "<font color=\"#" + colors[i % colors.length] + "\">" + t + "</font>";
i++;
}
}
texty = texty.replace("> <", "> <");
var REPLACEME = "[rainbow]" + RAINBOWTEXT + "[/rainbow]";
txt = txt.replace(REPLACEME, texty);
if (lastChar == txt.lastIndexOf("[/rainbow]")) {
break;
}
nextChar = lastChar + 10;
firstChar = txt.indexOf("[rainbow]", lastChar) + 9;
lastChar = txt.indexOf("[/rainbow]", lastChar);
}
}
txt = txt.replace("#", "'");
How to create/read/delete cookie in blackberry widget?
have same issue but trying out these codes:
function createCookie(name, value, days) {
eraseCookie(name);
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name, "", -1);
}