When you iterate through Office.context.mailbox.item.attachments, each AttachmentDetails object has id as Exchange attachment ID.
I assumed Exchange attachment ID to be the same as EWS Id.
I am trying to add an attachment from the current message to a new reply form, which I open with the displayReplyAllForm method. I am using the attachment id from the original message.
I get the following error:
There was an error attaching one or more of the attachments. You can close this response and try again in the app.
The following is the code I am using:
if (item.attachments.length > 0) {
var attach = item.attachments[1];
attachments.push({
'type': 'item',
'name': attach.name,
'itemId': attach.id
});
closeOutlookCLIDoc(true);
Office.context.mailbox.item.displayReplyAllForm({
'htmlBody': '',
'attachments': attachments
});
}
Please confirm the AttachmentDetails.id from attachments object of the message, which is according to documentation: Exchange attachment ID of the attachment, is the same as formData.attachments.itemId from Office.context.mailbox.item.displayReplyAllForm, which is according to documentation: The EWS item id of the attachment. This is a string up to 100 characters.?
Here is the guide I'm following.
the displayReplyForm API requires an EWS item id. What you are getting via the attachments collection is the attachment id. In short, we don't have an API that allows you to pass the attachment id over into displayReplyForm API and have that item added as an attachment. You have to either take that attachment and save it as an item in some folder for the user, so that then you can pass its EWS item id, or you have to get the attachment bytes, put them up on a URL and then add a file attachment.
Related
I am trying to add a validation into an existing Google Form. I was already able to identify the item ID of the field I want to add a validation. I am just doing first the very basic requireTextContainsPattern in my text validation. I tried to follow https://developers.google.com/apps-script/reference/forms/text-validation
function validationTest() {
var form = FormApp.openById('formID');
var item = form.getItemById(itemID);
var textValidation = FormApp.createTextValidation()
.setHelpText("Enter email address")
.requireTextContainsPattern("info#example.com")
.build();
item.setValidation(textValidation);
When I debug my code, I am getting
TypeError: item.setValidation is not a function
My question is: 1) How do I get this textvalidation into my the existing field in Google Form? 2) Is the error I am getting related to my question no. 1? But primarily, I wanted to resolve no. 1.
Thanks in advance!
Form.getItemById(id) returns Item. You need to change the reference from Item to TextItem. To do so you may use the method asTextItem() (see reference)
function validationTest() {
var item = form.getItemById(itemID).asTextItem();
// [...]
}
Note that this will throw an error if itemID is not an ID of a text item.
References
Interface Item (Google Apps Script)
Class TextItem (Google Apps Script)
I want to be able to send an email template to a customer which contains some data that is specific to the individual customer (e.g an order number, or a temporary password)
I've designed an email template which I intend to send to customers, but I'm not sure how to add this dynamic data to the template.
I'm using the API to send emails to customers, and I've learnt that you can send templates to customers with a request like so:
POST: https://mandrillapp.com/api/1.0/messages/send-template
Request Body:
{"key":"myApiKey","template_name":"test","template_content":[],"message":{"html":"","text":"","subject":"Template sending test","from_email":"someEmail","from_name":"Company Name","to":[{"email": "someOtherEmail", "type": "to"}]}}
Is it possible to add custom data such as { "orderNumber": "12345" } to the json, and if so how would the template know to render that in in the template email? I assume there must be a field you create which corresponds to the data in the post request.
I had a look at the metadata tags in the documentation, which allow you to add "custom, individualized metadata to messages" but it doesn't sound like you can add this data to an email template?
Ok.... If I had actually just continued reading the documentation it tells you how to do this!
https://mailchimp.com/developer/transactional/docs/templates-dynamic-content/#editable-content-areas
So you can add this html in your email template:
<div mc:edit="main">
Content to be replaced.
</div>
And then in my json, I can add replacement content for this area of the email in "template_content" (obviously!).
{
"key":"myApiKey",
"template_name":"test",
"template_content":[
{
"name":"main",
"content":"Hello World - content replaced"
}
],
"message":{
"html":"",
"text":"",
"subject":"Template sending test",
"from_email":"someEmail",
"from_name":"Company Name",
"to":[
{
"email":"someOtherEmail",
"type":"to"
}
]
}
}
response = zoho.inventory.getRecords("Item","i inserted ID in here");
var = response.get("Product Name");
for each hey in var
{
insert into SKU #SKU is a form in Zoho Creator
[
Added_User=zoho.loginuser
Item_Name=hey #Item_Name is my field in SKU
]
}
Above code not fetching the Product Name Data from Inventory into Zoho Creator
To serarch in Inventory you must use:
<response> = zoho.inventory.getRecords(<module>, <org_id>, [<criteria_map>], [<connection>]);
The module is Items. In "Settigs" -> "Profile organization" you can obtain your org_id. It returns a map and you have to iterate over response.get("Items")
I you want to get a single item and you have the ID you can use the next function
<response> = zoho.inventory.getRecordsByID(<module>, <org_id>, <record_id>, [<connection>]);
If you want to view the reponse, you can use "info response;" or "alert response;" depend where you are using it.
Are you sure, you are using the correct link name of 'Product Name' field, try 'Product_Name' instead.
Please Used the Correct API Name for fetch out in Map.
getRecords()- used to get all records (200) at time & for Individual records try this:getRecordsByID()
response = zoho.inventory.getRecords("Item","i inserted ID in here");
Org id is missing in this get record code.
var = response.get("Product Name");
make sure you are using a correct api name of the product name
I have called in Laravel's Mail inside my Controller like this:
\Mail::to($candidate)->send(new EmailVerification($candidate));
return view('/formsubmit');
The data received in the form are name, email, job_title, dob and interests. Is there a way I can receive the information entered by the user inside another email address?
According to the docs, you can add cc and bcc.
Mail::to($candidate)
->cc($moreUsers)
->bcc($evenMoreUsers)
->send(new EmailVerification($candidate));
I have a set of internal users for my project. Admin can activate/deactivate them. I want to send them a mail saying "your account has been deactivated" when their account is deactivated by admin. Similarly they should receive a mail saying "your account has been activated" when admin activates their account. How can I do this?
I am trying by creating 2 separate lists in mailchimp and two separate campaigns. but when I'm writing mailchimps credentials in my development.js with 2 separate list ids and then trying to get it in my javascript file,it is getting undefined (checked by console.log)..
Is there a way to do it by just single campaign/list?
Here's my development.js code of mailchimp credentials:
mailchimp: {
api_key: "***************-***",
list_id1: "*********", //internal users
list_id2: "*********" //internal deactivated users
},
my user.helper.js
const config = require('../../config/environment');
const Mailchimp = require('mailchimp-api-3');
const mailchimp = new Mailchimp(config.mailchimp.api_key);
exports.addToDeactivatedList = function (email, name) {
console.log(mailchimp.list_id1);
mailchimp.members.create(config.mailchimp.list_id1, {
email_address: email,
merge_fields: {
FNAME: name
},
status: 'subscribed'
}).then(user => { }).catch(e => {
console.log("deactivate list me add ho gya");
})
}
exports.addToActivatedList = function (email, name) {
console.log(mailchimp.list_id2);
mailchimp.members.create(config.mailchimp.list_id2, {
email_address: email,
merge_fields: {
FNAME: name
},
status: 'subscribed'
}).then(user => { }).catch(e => {
console.log("activate list me add ho gya");
})
}
and my user.controller.js (selective part only)
var helper = require('./user.helper');
.
.
if(req.body.status != user.status){
(req.body.status == "active") ? helper.addToActivatedList(user.email, user.name) : helper.addToDeactivatedList(user.email, user.name);
}
All the help will be appreciated. THANKS
I'd try to put everyone in the same list, and then create segments based on that list. After that, create a campaign based on that segment.
You could for instance create a custom list attribute that records wether or not an account is activated and create a segment based on that attribute. The campaign should then be based on that segment.
Perhaps also record the date an account has been activated or deactivated by the admin in another custom attribute and use that to check if a user already had an activation/deactivation mail.
MailChimp offers a feature for situations like this called automations. Automations allow you to send individual emails to subscribers when an event is triggered. So instead of creating separate campaigns every time a user is activated or deactivated, you can use just two automations and a single list.
Whether a user is active or not can be tracked with list merge fields. To do this, you'll need to add a new text merge field to your list. Let's name the field label 'Active'. Uncheck the 'Visible' checkbox so the user can't see it, and name your merge field something like 'ACTIVE'. You can use values like yes/no or true/false to identify the users by their active status.
Next, create your automations, one for activated users and one for deactivated users. You can set a trigger to send the email when a list field value is changed. So just make each of your two automations send the emails when the 'Active' list field values change to either 'yes' or 'no'.
Then all you need to do with the API is subscribe users to a single list whenever their accounts are activated or deactivated. Just make sure the new 'ACTIVE' merge field is set to 'yes' or 'no' when you do this, and any addresses already subscribed will be updated with the new value. So your mailchimp.members.create() would look something like this, based on the example from here:
mailchimp.members.create(<list_id>, {
email_address: <user_email>,
merge_fields: {
FNAME: name,
ACTIVE: 'yes' //Or 'no' if being used for deactivated users
},
status: 'subscribed'
})