Fetch Exchange online message details using InternetMessageId - outlook

When I get an event of SendAs (from other MS audit source) it contains very little info of the message itself, but has an InternetMessageId identifier.
I'm trying to fetch additional info using it but get only errors.
Firstly w/ the MessageTraceDetail report, I tried to fetch by either using the InternetMessageId as MessageId and as MessageTraceId, both return w/ same error:
GET https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTraceDetail
with query: "$filter" -> "MessageId eq guid'<AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE#mycorp.onmicrosoft.com>'"
{
"odata.error": {
"code": "",
"message": {
"lang": "en-US",
"value": "Unrecognized 'Edm.Guid' literal 'guid'<AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE#mycorp.onmicrosoft.com>'' at '13' in 'MessageId eq guid'<AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE#mycorp.onmicrosoft.com>''."
}
}
}
Secondly, w/ the Microsoft Graph API of get message
I created an AD App and granted it both Application and Delegated permissions of all "mail" related.
The request was w/ user principal name and the message id:
GET https://graph.microsoft.com/beta/users/myuser#mycorp.onmicrosoft.com/messages/%3AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE#mycorp.onmicrosoft.com%3E
which produces a generic 500 Internal Server Error.
What am I doing wrong?
Is there any other API to use that allow the get the message details using the InternetMessageId ?

GET https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTraceDetail
with query: "$filter" -> "MessageId eq guid''"
While the MessageId can contain a GUID it's not a Guid datatype so just query it as a String however you will need to escape the string to use it eg
System.Uri.EscapeDataString(("MessageId eq '" + InternetMessageId + "'")
https://graph.microsoft.com/beta/users/myuser#mycorp.onmicrosoft.com/messages/%3AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE#mycorp.onmicrosoft.com%3E
the id being referred to here is the Exchange Store identifier for the item which is different from the InternetMessageId you have to search for the Message using the InternetMessageId eg
https://graph.microsoft.com/v1.0/me/messages?$filter=internetMessageId eq '<AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE#mycorp.onmicrosoft.com>'

You could try to the following request of Graph API:
https://graph.microsoft.com/v1.0/me/messages?$filter=internetMessageId eq '<1430948481468.34600#THCIE7Dev2.onmicrosoft.com>'
For more, please see the link:
Microsoft Graph API - find message by internetmessageid

Related

Error while creating Sales Order with "API_SALES_ORDER_SRV"

we want to create a Sales Order with Cloud SDK (Version 1.9.2) using Virtual Data Model (A_SalesOrder) in our Java Application.
We are calling S4 OnPremise System (1709).
SalesOrder so = SalesOrder.builder()
.salesOrderType("ZKE")
.salesOrganization("DE01")
.distributionChannel("01")
.organizationDivision("00")
.build();
try {
SalesOrder salesOrder = new
SalesOrderCreateFluentHelper(so).execute(endpoint);
} ....
We are getting the following error (while executing via PostMan):
"errordetails": [
{
"code": "CX_SADL_ENTITY_SRVICE_NOT_SUPP",
"message": "The requested service is not supported by entity ~A_SALESORDER",
"propertyref": "",
"severity": "error",
"target": ""
},
{
"code": "/IWBEP/CX_MGW_MED_EXCEPTION",
"message": "An exception was raised",
"propertyref": "",
"severity": "error",
"target": ""
}
]
Can somebody give us a advise to create a Sales Order via the API?
How we can create Sales Order Items for this Sales Order in one Step?
Thanks!
Additional information OData Request Data
(Response Data not provided in ERROR_LOG):
Request-Header / Request-Body:
Apparently we received this error message because we did not include any items in the request. If you give it in your body it worked. Thank you
Can you pls share the OData request and response body and payload?
Open transaction /IWFND/ERROR_LOG, choose the error message and in the lower part of the screen, choose Request Data resp. Response Data and provide us both body and header. Make sure to omit any confidential data.

user.messages.get responding invalid ID

when attempting to test out the api explorer for user.messages: get I have been getting an invalid message ID response.
I am getting the message ID from a recent email in my inbox sent to me, and removed the <> from either ends.
response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Invalid id value"
}
],
"code": 400,
"message": "Invalid id value"
}
}
I am a bit confused as I am using the powershell module gshell and noticed that the same messageID worked in my commands but returned invalid id value in the api explorer.
edit: if I do a inbox search for rfc822msgid:[messageID] it returns the correct message
First you have to call the users.messages.list api. It will give a list of messageids. Then we have to call users.message.get api with each messageid to fetch the mail content. You can query the mails with advanced search options provided by Gmail API.
You should not use the rfc822msgid, but the Gmail API message id. Try to list messages and use the id you get from that when getting the message.

Microsoft Graph API: GET Outlook Calendar Event: Filter by Organizer Email

I'm trying to GET Outlook Calendar event by organizer email.
Here is the request URL I'm using:
https://graph.microsoft.com/v1.0/me/events?$filter=organizer/emailAddress/address eq 'john#gmail.com'
The request fails with this error:
501 Not Implemented: {
"error": {
"code": "UnsupportedEntityExpression",
"message": "'i => (i.Organizer.EmailAddress == \"john#gmail.com\")' is not a supported filter expression.",
"innerError": {
"request-id": "62206cba-ad9e-4051-b504-321cbcacc6fd",
"date": "2017-08-04T23:39:47"
}
}
}
FYI I'm running this request on an iPaas called Workato and this is the error message displayed on it.
What puzzles me is that this similar request works:
https://graph.microsoft.com/v1.0/me/events?$filter=organizer/emailAddress/name eq 'john doe'
Both name and address are properties of emailAddress so I'm not sure why the first request fails.
Has anyone filtered by organizer email before?
I could reproduce this error , and find a thread talking about same topic:
https://github.com/microsoftgraph/microsoft-graph-docs/issues/426
It seems a bug and hasn't been fixed currently .

Fetch messages filtered by conversationId via Office365 API

I'm having some trouble figuring out how to use the office365 api to fetch messages given a conversationId.
Let's say my conversationId is AAQkADlkOGJmMTFmLTc2NjMtMKL3My04ZDhkLTVmZWNjMzA1ODY0NAAQAB11Xh2opSpBiXifMEJjhow=
I'll make a request like
https://outlook.office.com/api/v1.0/me/Messages?$filter=ConversationId%20eq%20AAQkADlkOGJmMTFmLTc2NjMtMKL3My04ZDhkLTVmZWNjMzA1ODY0NAAQAB11Xh2opSpBiXifMEJjhow=
This results in a 400 response like this:
{
"error": {
"code": "RequestBroker-ParseUri",
"message": "Syntax error at position 98 in 'ConversationId eq AAQkADlkOGJmMTFmLTc2NjMtMKL3My04ZDhkLTVmZWNjMzA1ODY0NAAQAB11Xh2opSpBiXifMEJjhow='."
}
}
I tried other things, such as url encoding the conversationId to AAQkADlkOGJmMTFmLTc2NjMtMKL3My04ZDhkLTVmZWNjMzA1ODY0NAAQAB11Xh2opSpBiXifMEJjhow%3D which results in the same error.
I also tried simply removing the = which seems to be the character that is freaking it out
https://outlook.office.com/api/v1.0/me/Messages?$filter=ConversationId%20eq%20AAQkADlkOGJmMTFmLTc2NjMtMKL3My04ZDhkLTVmZWNjMzA1ODY0NAAQAB11Xh2opSpBiXifMEJjhow
but that results in the following error
{
"error": {
"code": "RequestBroker-ParseUri",
"message": "Could not find a property named 'AAQkADlkOGJmMTFmLTc2NjMtMKL3My04ZDhkLTVmZWNjMzA1ODY0NAAQAB11Xh2opSpBiXifMEJjhow' on type 'Microsoft.OutlookServices.Message'."
}
}
I've also tried messing with the url capitalization and using + signs instead of %20 for the filter string, but I consistently get 400 errors back.
I am able to filter by other fields though. For example
https://outlook.office.com/api/v1.0/me/Messages?$filter=IsRead%20eq%20true
returns messages filtered as I would expect.
Any idea what could be going on with the ConversationId filter?
You need to wrap the ConversationId with single quotes.
This is how I forge my request in C#
string finalUrl = "https://outlook.office.com/api/beta/me/Messages?$filter=" + HttpUtility.UrlEncode(string.Format("ConversationId eq '{0}'", conversationId));

Using the insert method of the Google Data Transfer API to start a transfer

I am trying to use the transfers:insert method of the Google Admin SDK Data Transfer API. I am performing this API call as the super admin account of my domain. I have verified that API access is enabled for our domain, and that the Super Admin admin role has permission to use the Data Transfer API.
I am testing this in the APIs Explorer on this page.
55656082996 is the ID string that I got for Google Drive from the applications:list APIs Explorer.
Request:
POST https://www.googleapis.com/admin/datatransfer/v1/transfers?key={YOUR_API_KEY}
{
"oldOwnerUserId": "olduser#ourdomain.com",
"newOwnerUserId": "newuser#ourdomain.com",
"applicationDataTransfers": [
{
"applicationId": "55656082996"
}
]
}
Response:
400 OK
- SHOW HEADERS -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid value for: Invalid oldOwnerUserId."
}
],
"code": 400,
"message": "Invalid value for: Invalid oldOwnerUserId."
}
}
I get the same "Invalid value for: Invalid oldOwnerUserId." response no matter if I use email addresses or usernames. I also tried excluding the applicationDataTransfers array from the response, but that also didn't work.
The documentation does not say this, but the Id cannot be the user's email address, like in all of the other Google APIs, but rather it needs to be a numeric ID for the user that you can get using the Users:get Directory API method.
I figured this out by Google searching and coming across this documentation, where they elaborate upon oldOwnerUserId by saying "# ID"
In addition to the answer above.
Here is how you can get the employee' IDs from Gsuite API in Python 3.*
def create_directory_service():
credentials = cls.get_credentials(scopes=['https://www.googleapis.com/auth/admin.directory.user'])
return build('admin', 'directory_v1', credentials=credentials, cache_discovery=Fals
service = create_directory_service()
old_owner_google_id = service.users().get(userKey=old_owner).execute()['id']
new_owner_google_id = service.users().get(userKey=new_owner).execute()['id']

Resources