Sorry for being Amateur at this but please help,I am trying to create new label name news1 and this is code i have done.
This is the function call which i have used.
createLabel();
My function
function createLabel() {
var newLabelName="news1";
var request = gapi.client.gmail.users.labels.create({
'userId' : 'me',
'labels' : {
"labelListVisibility" : "labelShow",
"messageListVisibility" : "show",
"name" : newLabelName,
"id" : "news"
}
});
request.execute();
}
If you use your function like this only, it can't works. You have to authenticate yourself first with a client id provided by Google and permissions scopes you need for your code.
Ressources :
Quickstart with gmail js (authentification) : https://developers.google.com/gmail/api/quickstart/js Creation label doc : https://developers.google.com/gmail/api/v1/reference/users/labels/create