我正在寻找一种方法来使用Office 365 REST Message API检测和设置电子邮件的"已标记"状态.我没有看到'Flag'被列为REST消息的属性,但我确实看到它列在Exchange Web服务下.
我试图做一个REST调用,将Flag添加到过滤的属性,以及SingleValueExtendedProperties和MultiValueExtendedProperties,如:
/folders/inbox/messages?$top=50&$select=Subject,...,Flag
/folders/inbox/messages?$top=50&$select=Subject,...,SingleValueExtendedProperties
/folders/inbox/messages?$top=50&$select=Subject,...,MultiValueExtendedProperties
Run Code Online (Sandbox Code Playgroud)
所有这些都以某种形式回归:
{"error":{"code":"RequestBroker-ParseUri","message":"Could not find a property named \\\'Flag\\\' on type \\\'Microsoft.OutlookServices.Message\\\'."}}
Run Code Online (Sandbox Code Playgroud)
有关如何通过REST API访问Outlook"Flag"属性的任何建议?
我已经修改了官方 PHP 示例以获取 10 多个日历事件
这是原始的 OData 查询:
$getEventsParameters = array (
// Only return Subject, Start, and End fields
"\$select" => "Subject,Start,End,Location,Attendees,Organizer",
// Sort by Start, oldest first
"\$orderby" => "Start/DateTime",
// Return at most 10 results
"\$top" => "10"
);
Run Code Online (Sandbox Code Playgroud)
我变成了:
$getEventsParameters = array (
// Only return Subject, Start, and End fields
"\$select" => "Subject,Start,End,Location,Attendees,Organizer",
// Sort by Start, oldest first
"\$orderby" => "Start/DateTime"
);
Run Code Online (Sandbox Code Playgroud)
但是我仍然只返回了 10 个事件。为什么?
我找到了有关如何使用Office 365 rest API发送电子邮件的以下文档.
这是关于doucmentation的例子:
POST https://outlook.office.com/api/v2.0/me/sendmail
{
"Message": {
"Subject": "Meet for lunch?",
"Body": {
"ContentType": "Text",
"Content": "The new cafeteria is open."
},
"ToRecipients": [
{
"EmailAddress": {
"Address": "garthf@a830edad9050849NDA1.onmicrosoft.com"
}
}
],
"Attachments": [
{
"@odata.type": "#Microsoft.OutlookServices.FileAttachment",
"Name": "menu.txt",
"ContentBytes": "bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
]
},
"SaveToSentItems": "false"
}
Run Code Online (Sandbox Code Playgroud)
如果用户授权应用程序代表它执行操作,则此方法正常.但是,我使用客户端信任来构建一个守护程序应用程序,代表给定租户中的所有用户,因此"POST https://outlook.office.com/api/v2.0/me/sendmail "无法正常工作因为它引用了"我",无法分辨哪个用户正在发送电子邮件.
如果你可以提供示例示例,我会谨慎行事.仅供参考:我使用的是Java,但您的答案不一定是Java.
exchange-server azure-active-directory adal outlook-restapi office365api
我正在使用 ms graph api 来获取所有带有附件的消息。除此之外,我需要获取具有 docx/pdf 扩展名的文件。以下是我尝试过的过滤器。
https://graph.microsoft.com/v1.0/me/messages ?$filter=hasAttachments eq true 和 ext eq 'docx'
https://graph.microsoft.com/v1.0/me/messages ?$filter=hasAttachments eq true 和扩展 eq 'docx'
我正在尝试使用以下请求调用outlook API:
https://outlook.office.com/api/v2.0/me/calendars
GET
Authorization: Bearer [my fresh bearer token]
Run Code Online (Sandbox Code Playgroud)
登录和用户同意后,我成功从令牌端点检索了access_token.
但是,我尝试的每个请求都会使用以下标题返回401 Unauthorized(显示一个因为它看起来很奇怪):
WwwAuthenticate [HttpHeaderValueCollection]: {Bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token", Basic Realm="", Basic Realm="", Basic Realm=""}
Run Code Online (Sandbox Code Playgroud)
如您所见,最后有错误="invalid_token"
此外,还有app_asserted_user_v1 service_asserted_app_v1
有没有我忘记激活或配置正确的东西?
编辑:我确实找到了这篇文章,但如果我添加像OP这样的资源参数,我得到"错误的请求"和这段代码:
AADSTS90100:不支持"资源"请求参数.
我正在使用 Microsoft Graph 与 Outlook 连接。有人可以帮我解决我的问题吗?我需要添加多个ccRecipient和bccRecipient。我的网络应用程序通过 API 发送、接收和读取电子邮件。但我无法向多个收件人发送cc电子邮件bcc。这是我用来发送电子邮件的功能。
编辑:现在 JSON 中的函数没有 2ccRecipients和 2 bccRecipients 。我尝试了多种不同的方式,但是当我在 microsoft graph-explorer 中测试它时,它无法发送到多个地址。
function sendEmail(){
getAccessToken(function(accessToken) {
if (accessToken) {
// Create a Graph client
var client = MicrosoftGraph.Client.init({
authProvider: (done) => {
// Just return the token
done(null, accessToken);
}
});
var recipient = $("#recipient").val();
var subject = $("#subject").val();
var carbon_copies = $("#carbon_copies").val();
var blind_carbon_copies = $("#blind_carbon_copies").val();
var filename_attachment = $("#filename").text();
var attachments_base64 = …Run Code Online (Sandbox Code Playgroud) 我们使用 Microsoft Graph API 将 Outlook 集成到我们的 iOS 应用程序中。我们有一个用例,必须按附件名称或主题过滤 Outlook 邮件。我们使用查询参数来命中图形 API。
\n\n链接到微软文档。
\n\n根据上述文档,$search参数用于过滤 Outlook 消息。当点击以下 API 时,我们会得到错误的响应。它\xe2\x80\x99s 返回主题和邮件正文中都有\xe2\x80\x9cTest Mail\xe2\x80\x9d 的邮件。但它应该只返回主题行为 \xe2\x80\x9cTest Mail\xe2\x80\x9d 的邮件。
https://graph.microsoft.com/v1.0/me/messages?$search="subject:Test Mail\xe2\x80\x9d \nRun Code Online (Sandbox Code Playgroud)\n\n当我们通过点击下面的 API 按附件名称过滤邮件时,我们也会遇到同样的问题。事实上,在这种情况下我们得到的是空响应。
\n\nhttps://graph.microsoft.com/v1.0/me/messages?$search=\xe2\x80\x9cattachments:test.png\xe2\x80\x9d \nRun Code Online (Sandbox Code Playgroud)\n\n上述 URL 格式是否正确?为什么我们\xe2\x80\x99没有得到期望的响应?请帮助我们解决这个问题。
\n