Gmail api get labels avoid capital letters - ios

I'm currently using Gmail api and getting gmail api labels return capitalized letters.
Like Inbox is returned as INBOX
id = INBOX;
name = INBOX;
type = system;
Could anyone please share what query to pass to get correct label names?

In the API, system labels (e.g. INBOX, SPAM, etc.) are capitalized, there's just no way to return them "correct" (as in the UI).
If you want to retrieve the label with only the first letter capitalized, you'll have to modify the label string after it is returned by the API.
Reference:
Types of labels

Related

exclude certain text from keyword analysis in google sheets

I'm trying to do a little bit of analysis on the topics of emails I receive. I have the emails in a Google-sheet in the format below. I'm trying to count how often 'privacy' or 'confidentiality' are mentioned. My challenge is that pretty much every email signature mentions one of those words, so when i use SEARCH every cell returns TRUE.
Most email signatures start with similar phrases, so I tried deleting anything after those phrases with this formula:
=ArrayFormula(TRIM(LEFT(B1:B,MIN(IFERROR(FIND({" This email and any","IMPORTANT NOTICE", " Important notice","The information in this email"," The contents of this message"," Information in this email including"," This electronic mail message"," this message and any attachments"," This message is intended for the addressee only"," This email is CONFIDENTIAL"},B1:B),LEN(L2))))))
Column B is the column with the email body text in.
However that seems to be deleting text that follows words that aren't in my search (deleting everything after 'not' instead of 'IMPORTANT NOTICE' for instance).
Could anyone advise on either:
what's wrong with my above search
an alternate way of searching for 'privacy' and 'confidentiality' without including text from email signatures.
Example table:
|email title|email body|
|-----------|----------|
|Do you want to buy my stuff| Hi there, I'd like to know if you'd like to buy this thing I want to sell you. IMPORTANT: this email is private|
|two-for-the-price-of-one| I've a great offer for you! This email and attachments are private & confidential|
|Last chance to buy stuff!| Can we have a private call about whether you want to buy my stuff yet?|
In the example above I want to count row 3, but not rows 1 & 2, as the 'private' and 'confidential' mentions in 1 & 2 are in the signature.
Thanks!
I think I understand the error that you've described is occuring with your formula. Once the formula finds one of the values you are using to try to identify an email signature, such as " Important notice", and returns the location of that text, let's say position 96, it then uses 96 for all of the cells, like this: LEFT(B1:B,96). So you might not be able to do the compound arrayformula of an arrayformula that you are trying.
Using the formula like this, in B2, and dragging it down, should work though:
=ArrayFormula(TRIM(LEFT(B2,MIN(IFERROR(
FIND({" This email and any","IMPORTANT NOTICE", " Important notice","The information in this email"," The contents of this message"," Information in this email including"," This electronic mail message"," this message and any attachments"," This message is intended for the addressee only"," This email is CONFIDENTIAL"},B2),
LEN(L2))))))
Note: I'm not sure what value is in your L2.
But for the overall approach, it really depends on how well your terms to identify email signatures work, so as to exclude them from your final full text searches.

Exact text searches with the Microsoft Graph API

Can we do exact text searches using the the Microsoft Graph API?
I know the endpoint for search is:
GET /me/drive/root/search(q='{search-query}')
The documentation is unclear about what to pass into the search query (q) parameter.
The query text used to search for items. Values may be matched across several fields including filename, metadata, and file content.
I have tried double quote formats
https://graph.microsoft.com/v1.0/me/drive/root/search(q='"Bob Bowen"')
and '+' formats
https://graph.microsoft.com/v1.0/me/drive/root/search(q='Bob+Bowen')
I'm running these queries using the "Try it" button on the Microsoft Graph Explorer and I'm expecting them to return nothing because the words "Bob Bowen" shouldn't exist in the sample drive. But I'm always getting some document hits, because the exact text search isn't working.
I just happened to have
IDriveItemSearchRequestBuilder searchRequest = graphServiceClient.Me.Drive.Root.Search(searchFile);
var searchResult = searchRequest.Request().GetAsync().Result.ToList();
In other variants, authorization error

Using period / dot when searching users by email on Microsoft Graph API and ODATA return no results

I'm using Microsoft Graph API to get all users from my directory that have their email address starting with a given value.
All is working well except when my value contains a period / dot. In this case, the Graph API returns no result.
How can I search all users with their email starting by a given value containing a period / dot.
Here's an example.
The following request works fine:
https://graph.microsoft.com/v1.0/users?$filter=startsWith(displayName, 'john')
The following request (containing a dot in the odata query) returns no results
https://graph.microsoft.com/v1.0/users?$filter=startsWith(displayName, 'john.d')
I already tried to encode the dot / period with %2E and it does not work:
https://graph.microsoft.com/v1.0/users?$filter=startsWith(displayName, 'john%2ed')
Does anybody know how I can do that ?
Thanks !
Based on my test, dot should work in this filter query.
If we want to search the users by email. we could $filter the field mail not the field displayName.
https://graph.microsoft.com/v1.0/users?$filter=startsWith(mail, 'john.d')

Text replacement

I have a small business that uses Google Sheets to track our employee's cases. When they are typing in that they are handling a case they just put their initials. I would like to make use of the Reminders addon to make sure that cases are not forgotten. The Reminders addon requires that an email be given with who to contact so that it can send them an email reminder. However it is faster to simply type the initials of the case worker.
How to manipulate the functions or write a custom one so that all initials in a certain column can be replaced with the corresponding email?
For example:
=IF(B2="ABC", SUBSTITUTE(B2,"ABC","ABC#123.com"))
Will place ABC's email if the initials ABC are found in a new cell. However I can't expand the function to replace all the employees initials in one script as IFELSE is not recognized as a valid function.
You could do this with a simple vlookup
Make a new sheet with two columns. The first containing the initals the second containing the email addresses.
In a new column in sheet1 you would then write somethign like this:
=vlookup(B2,Sheet2!A1:B25,2)
Where B2 is the cell with the initials and Sheet2!A1:B25 is the range where you store the email addresses.

Retrieve all hashtags from a tweet

Is it possible using the Twitter API to retrieve a list of all hashtags present within a single tweet?
For example, let's say I have a tweet (let's say it has an ID of 12345) with the following text:
Hi. I love #stackoverflow because it's #superawesome. #fb
Is there an API call that will give me back #stackoverflow, #superawesome, & #fb when I give it an ID of 12345?
Or do I just have to parse the text of the tweet myself?
You'll have to use a regular expression in your language of choice
#\S+
should match any hash, beginning with # and made of a string of characters. It stops at the first space.
If you want to exclude any trailing symbol and have a letter as the last char :
#\S*\w
This expression should work in most of the regex engines I'm aware of.
You can use Tweet Entities. Just include &include_entities=1.
The Twitter API does not have any functions specifically designed for hashtags. You'll need to parse the text on your own.
Although #ialphan's solution is good, if you want to sort hashtags with occurance just use this answer in similar question:
Retrieve all hashtags from a tweet in a PHP function

Resources