Search email sender address using Office 365 REST API - search

I'm trying to return emails from Office 365 where the sender's email matches my query string. I tried $filter with contains but this threw an error stating I must use $search. The following works but doesn't restrict the scope of my search, i.e. to /Sender/EmailAddress/Name. Any ideas?
https://outlook.office365.com/api/v1.0/Me/Messages?$select=Subject,Sender,From&$search="Joe Bloggs"

If you use a filtering method that is not supported, you will get an error message like the error you got .
In addition , When use $search query parameter without specifying a property ,the result will search the Body, Sender, and Subject properties. In your request , that will return all messages in the Inbox that contains your keyword in any of the three default properties.
The $search system query option restricts the result to include only those entities matching the specified search expression. You could click here for common fields by using the $search query parameter , if get all messages in the Inbox that were sent from a specific person is your requirement , you could try below query :
https://outlook.office.com/api/v2.0/me/messages?$search="from:help#contoso.com"
Above request also works in v1.0 , but return properties of the message are not the same (compare to v2.0) .

According to Resource reference for the Mail, Calendar, Contacts, and Task REST APIs, Office 365 REST API has its own Advanced Query Syntax for the $search option. From that, it seems that you can restrict your search using the from: qualifier.
GET https://outlook.office.com/api/v2.0/me/messages?$search="from:Joe Bloggs"
Note that the URI should be encoded (i.e., the double quotes and the space need to be percent encoded). Also, the examples are using v2.0 of the API. I'm not sure if this works with v1.0.

Related

Get Status Changes for Envelopes

I am trying to use the GET envelopes API, and specifying a folder. My folder_ids parameter is below:
&folder_ids='Sent Items'
I have also tried 'completed' and 'sent_items', but I get the same error:
"message": "The request contained at least one invalid parameter. folder_ids must be a comma separated list of either valid folder Guids or 'awaiting_my_signature', 'completed', 'draft', 'drafts', 'expiring_soon', 'inbox', 'out_for_signature', 'recyclebin', 'sentitems' or 'waiting_for_others'."
Does anybody know what I am doing wrong for my filter?
When specifying a folderId it needs to be in a GUID format, unfortunately you cannot request envelopes based on the name of the folder.
The good news is that if you're looking for sent items there's another parameter you can use that is a bit more universal:
envelopes?from_date=8-1-2021&to_date=9-3-2021&folder_types=sentitems
I also tested folder_ids and it looks like the value for the sentitems folder os 'sentitems' there as well. You may want to consider opening a case with us to go over the process in realtime at https://support.docusign.com.
Regards,
Matt

Docusign API: Searching for a given Envelope/Envelopes using Custom Field

How do we compose a get url to get an envelope or envelopes that contain a given custom field. I tried to compose a get url as one shown below but not getting the desired results (i tried to follow the documentation here -> https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/listStatusChanges but I think i am not passing the custom field to the query string correctly
https://demo.docusign.net/restapi/v2.1/accounts/ACCOUNT_ID_NUMBER/envelopes?from_date=2019-12-05&folder_types=sentitems&status=completed&custom_field=[SignerEmail=john.doe#email.com]
You're using the right API call. Try it without the square brackets and encode the value.
Eg
... &custom_field=SignerEmail%3Djohn.doe%40email.com
The above is untested. If it doesn't work, we'll dig into it further
Important: are you trying to find envelopes that have a custm_envelop_field (metadata) that you created and you named "SignerEmail"?? If so, the the above is the way to go.
If you're looking for envelopes where a signing recipient's email is john#doe.com, try the general search as Inbar suggests. If it doesn't work, you may need another tactic.
Suggest you read here:
https://developers.docusign.com/esign-rest-api/guides/concepts/envelopes/search
the parameter is called search_text and would search everything including custom fields. There's no need to separately specify custom fields.
Something like this:
https://demo.docusign.net/restapi/v2.1/accounts/ACCOUNT_ID_NUMBER/envelopes?search_text=[SignerEmail=john.doe#email.com]

Using Graph API to query SharePoint list items and expand user field

I'm trying to query for some SP list items, all is working fine except I can't seem to expand a custom column of type Person.
I can see the createdBy and lastModifiedBy expanded and even includes the AAD user id, which is great and also leads me to think what I want is possible!
But mine is a custom column.
I'm running this and can only seem to get the SP user list id and the user's display name...neither of which are much use.
/items?expand=fields(select=UserLookupId,User)
Ideally I'd like to get the AAD user id as per createdBy and modifiedBy field, but the email would suffice.
Otherwise the only way I can see is to query the User Information List (using the UserLookupId) to get the email?
Thanks
This appears to be correct assumption:
Otherwise the only way I can see is to query the User Information List
(using the UserLookupId) to get the email?
for non-system user fields, it is indeed a way to go, but there are some distinctions whether user field is multi-valued or single-valued.
If Approvers is a multi-valued user field, then the following query:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields($select=Approvers)
returns email and id properties along with displayName property for user field value.
While for single-valued user field only id (available via {userfield}LookupId property) and displayName properties could be requested via items endpoint, for example:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields($select=Approver,ApproverLookupId)
So, indeed User Information List needs to be utilized to request additional user properties, for example:
https://graph.microsoft.com/v1.0/sites/root/lists('User Information List')/items/{item-id}/?$expand=fields($select=Email)
where item-id corresponds to user field lookup id
This was my experience modifying the
Build Angular single-page apps with Microsoft Graph. In the examples below, I changed my id's out with the default text.
Here is
The Finished Project on thier github
In Graph Explorer, this worked. You can verify it at the Microsoft Graph Explorer.
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields($select=id,Title)
In the app/graph.service.ts in the app, this did not work. Even though you would expect it to based on the graph explorer.
.api('/sites/{site-id}/lists/{list-id}/items?fields($select=id,Title)')
Changing the app/graph.service.ts api call worked.
.api('/sites/{site-id}/lists/{list-id}/items?')
.expand('fields($select=id,Title)')
The result looked like this:
fields: {
#odata.etag: ""d6f5b6ea-9f90-452d-98ba-e838f58d3359,1"",
Title: "IT SPECIALIST (MID)",
id: "20"
}
Here's an example site id:
some.sharepoint.com,9dk062b-2e54-4e4f-b71a-cdb74f42cc44,c6cf6b0a-cc7c-41fd-a76a-ef8f97e8a22f
Here's an example list id.
8eg8c29a-5555-4cfc-bfa4-0e907488f781
The end url won't have any {} in it.

Using DocuSign REST API to set Data Validation

I can populate a text field with a date (ex. 12/31/2016) using the REST API. I want to set it so that if a user makes any changes to the text field they must use the same date format.
I've read about setting a validationPattern and validationMessage, but when I put <validationPattern>mm/dd/yyyy</validationPattern> it was more of a literal validation where the field had to be "mm/dd/yyyy".
Is there documentation on how to set the validationPattern with the REST API?
Also, I originally had it so that I set the mask value = date for the text field, but when I tried to populate the field using the REST API it was empty. And I believe I was submitting the correct format (1/1/2016).
As the manual states,
Javascript RegEx object is used for regular expression validation.
So you need to enter a regular expression. The mm/dd/yyy should be presented to your users as instructions, it isn't the regexp.
If you want mm/dd/yyyy try this one from StackOverflow:
^((0?[1-9]|1[012])[- \/.](0?[1-9]|[12][0-9]|3[01])[- \/.](19|20)?[0-9]{2})*$
Try it online
Note: I escaped the literal / by using \/ I don't know offhand if you should escape the regex when entering it via the API or via the browser. I suggest that you test by using the web browser access to DocuSign, then switch to the API.

Retrieving Recipient Status via REST API

There appears to be two ways I can gather status information about individual recipients on an envelope:
GET - v2/accounts/:accountId/envelopes/:envelopeId/recipients
GET - v2/accounts/:accountId/envelopes/:envelopeId/audit_events
Unfortunately, each of these suffers from a separate limitation that is making it difficult for me to use either.
This API call returns two DateTime values of interest: deliveredDateTime and signedDateTime. I am able to call and use this API successfully. However, it appears to me that deliveredDateTime is not specified until the user actually clicks the email link AND clicks the review documents button on the signer view. Since what I was actually interested in might be better described as sentDateTime, deliveredDateTime doesn't appear to work for my needs.
This API call returns a detailed list of all events that have transpired on the envelope, including individual receipient status updates. However, the data format is such that in order to tie the result data back to recipients, I have to do string matches on the recipient name. I'd prefer to do the match based on email or, better still, recipientID, but the audit log entries for "sent invitations" and "signed" don't contain these fields. Here is an example (click here to view larger):
Is there an API call other than these two that I can use? Is there a way to get additional data in the audit event API call?
Thank you in advance,
Andrew
I don't believe there's a way to get additional data from the audit_events call since the DocuSign API documentation (which is up to date) indicates that call has no parameters (other than the envelopeId in the URL).
I think you're stuck with doing a string comparison on the userName value to identify/link your recipients, however I want to point out that once you do that you can then link to their unique recipientGuid through the first api call you've highlighted here.
For instance, the /audit_events API call seems to achieve what you want and has all the info you need, however it identifies the recipients through their userNames. If you then make a call on the same envelope and check the response from the /recipients URI, it contains the name, email, recipientId, and recipientGuid for each and every recipient in the envelope. Match the user names and you now have access to their IDs, etc.
So in the end I don't believe there's one API call to achieve this but you can solve by doing one string compare and combining the results from the API calls you've highlighted.

Resources