我使用https://graph.microsoft.com/beta/me/photo/ $ value API来获取outlook用户的个人资料图片.我得到了一个关于在rest-client中运行上述API的图像.API的内容类型是"image/jpg"
但是,在Node.js中,API的响应如下:
????\u0000\u0010JFIF\u0000\u0001\u0001\u0000\u0000\u0001\u0000\u0001\u0000\u0000??\u0000?\u0000\u0005\u0005\u0005\u0005\u0005\u0005\u0006\u0006\u0006\u0006\b\t\b\t\b\f\u000b\n\n\u000b\f\u0012\r\u000e\r\u000e\r\u0012\u001b\u0011\u0014\u0011\u0011\u0014\u0011\u001b\u0018\u001d\u0018\u0016\u0018\u001d\u0018+"\u001e\u001e"+2*(*2<66<LHLdd?\u
Run Code Online (Sandbox Code Playgroud)
我用'fs'来创建一个图像文件.代码如下:
const options = {
url: "https://graph.microsoft.com/beta/me/photo/$value",
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${locals.access_token}`,
'Content-type': 'image/jpg',
}
};
request(options, (err, res, body) => {
if(err){
reject(err);
}
console.log(res);
const fs = require('fs');
const data = new Buffer(body).toString("base64");
// const data = new Buffer(body);
fs.writeFileSync('profile.jpg', data, (err) => {
if (err) {
console.log("There was an error writing the image")
}
else {
console.log("The file is written successfully");
}
});
});
Run Code Online (Sandbox Code Playgroud)
文件写入成功,但.jpg …
我对此的搜索完全是徒劳的,我甚至不确定是否可能.
这在Powershell中是完全可能的,我已经在Powershell中做了这个,但我想编写一个C#程序来执行某些任务,但无法找到哪些API可以执行这些任务:
1)获取所有用户及其分配的计划的许可信息
2)获取特定Office 365租户的所有邮箱和电子邮件地址的列表.
在Powershell中很容易做到,但有没有哪种API可以完成这些类型的整体管理任务?!如果有,我找不到它,所以任何方向都会有所帮助
我正在尝试使用Microsoft Graph API查询Outlook/O365邮箱中的邮件.我在Azure门户中注册了我的应用程序,并收到了查询API的必要信息.该应用已获得Mail.Read
许可.(我无权访问Azure门户,我被告知它是以这种方式设置的.)但是,当我从OAuth端点获取令牌时,它在任何后续调用中都不起作用.我正在使用Python的请求模块进行测试.
为什么这个电话失败了?好像我传递了所有正确的信息,但我显然遗漏了一些东西.
我通过执行POST
on 获取令牌:
https://login.microsoftonline.com/my.domain/oauth2/token
Run Code Online (Sandbox Code Playgroud)
我传递了必要的参数:
data = {'grant_type': 'client_credentials', 'client_id': CLIENTID, 'client_secret': SECRET, 'resource': APPURI}
Run Code Online (Sandbox Code Playgroud)
我收到这样的回复:
{
'resource': 'APPURI',
'expires_in': '3599',
'ext_expires_in': '3600',
'access_token': 'TOKENHERE',
'expires_on': '1466179206',
'not_before': '1466175306',
'token_type': 'Bearer'
}
Run Code Online (Sandbox Code Playgroud)
但是,我尝试使用该令牌,但它对我所称的任何内容都不起作用.我将它作为标题传递:
h = {'Authorization': 'Bearer ' + TOKEN}
Run Code Online (Sandbox Code Playgroud)
我正在调用此网址:
url = 'https://graph.microsoft.com/v1.0/users/my.email.address@example.com/messages'
Run Code Online (Sandbox Code Playgroud)
具体来说,我用这个:
r = requests.get(url, headers=h)
Run Code Online (Sandbox Code Playgroud)
回复是401:
{
'error': {
'innerError': {
'date': '2016-06-17T15:06:30',
'request-id': '[I assume this should be removed for privacy]'
},
'code': 'InvalidAuthenticationToken',
'message': 'Access …
Run Code Online (Sandbox Code Playgroud) 我想知道Office365 REST API(人员,邮件)每分钟/小时API调用的限制.
有没有任何文件?
我在https://apps.dev.microsoft.com
(平台:Web)中创建了一个应用程序
此应用需要管理员同意某些权限.我记得,在过去,访问https://login.microsoftonline.com/{tenant name}/adminconsent?client_id={application id}&state={some state data}&redirect_uri={redirect uri}
管理员帐户是为了允许访问我们组织中只有管理员可以授予的资源.从那里,用户需要提供用户级别的同意才能使用该应用程序.
现在,我可以使用管理员帐户成功登录,并且应用程序按预期工作但是我仍然会收到用户提示,并显示以下消息:
You can't access this application
APP NAME needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it.
Have an admin account? Sign in with that account
Return to the application without granting consent
错误消息是:AADSTS90094: The grant requires admin permission.
似乎没有记录在任何地方..
如果我点击Have an admin account? Sign in with …
我试图从Microsoft Graph API访问加入的组,我已经完成了Azure AD身份验证并能够获得所需的访问令牌.
当我从SharePoint OData端点读取数据但是我无法访问URL时,访问令牌正在工作
https://graph.microsoft.com/beta/me/joinedTeams
Run Code Online (Sandbox Code Playgroud)
我试图使用PostMan客户端访问它,它给了我错误
{
"error": {
"code": "AuthenticationError",
"message": "Error authenticating with resource.",
"innerError": {
"request-id": "ef4be9c8-27c7-40e7-8157-c08848f5132f",
"date": "2018-03-13T09:46:11"
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试使用javascript代码访问此URL时,我得到了不同的错误
{
"error": {
"code": "BadRequest",
"message": "Invalid version",
"innerError": {
"request-id": "51113cc5-2963-4e0f-bf70-6e080a8f5671",
"date": "2018-03-13T09:29:18"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了不同的权限集,即使有行政访问但没有运气.
我也尝试过访问
https://graph.microsoft.com/beta/me/
Run Code Online (Sandbox Code Playgroud)
它在PostMan客户端工作,但不在JavaScript中工作(我得到了同样的错误).
Tere是我用来发送请求的标头
var header = {
Authorization: "Bearer <ACCESS_TOKEN>",
Accept: "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false"
};
Run Code Online (Sandbox Code Playgroud)
任何人都可以建议我错过了什么或我应该使用什么权限?
这些权限需要管理员同意,这些权限是否正确?
更新2 我尝试使用管理员同意,授予应用程序所有必需的权限(AD应用程序).以下是从jwt.io中提取的范围数据
"scp": "email Group.Read.All Group.ReadWrite.All openid User.Read User.Read.All User.ReadBasic.All User.ReadWrite.All"
"aud": "https://graph.microsoft.com/"
Run Code Online (Sandbox Code Playgroud)
我正在使用具有所有权限的管理员帐户.但没有运气,我仍然得到"使用资源进行身份验证时出错". 但是使用令牌我可以访问URL …
我无法找到使用图表订阅所有用户更改的方法,看起来它是不可能的.
所以我开始单独订阅每个人,理想情况下我希望最终来自日历,电子邮件和联系人的所有更新,但我开始使用日历.
代码与我的用户完美配合,但是当我尝试订阅所有人(大约300个用户)时,我达到了七个订阅的硬限制,因为进一步的请求失败并具有通用Bad Request
状态.
在官方文档https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/webhooks中说:
限制某些限制适用,并且可能在超出时产生错误:
1)最大订阅配额
- 每个应用程序:总订阅50,000
- 每个租户:所有应用程序共有35个订阅
- 每个应用程序和租户组合:7个订阅总数
租户似乎是指一个实际的活动目录,因此我们限制为每个应用7个,或总共35个.
将用户分成域的多个活动目录是没有可能的,即使玩杂耍多个应用程序做同样的事情似乎很奇怪,这些限制对我来说毫无意义.
有没有办法增加这些微小的限制?
我订阅了users/$email/events
所以我发帖到https://graph.microsoft.com/v1.0/subscriptions
{
"changeType": "created,updated,deleted",
"notificationUrl": "https://webhooks.mydomain.com/my/endpoint",
"resource": "users/$email/events",
"expirationDateTime":"2018-05-12T16:00:00.9356913Z",
"clientState": "my-super-secret-identifier"
}
Run Code Online (Sandbox Code Playgroud)
只要我想要<= 7个订阅,它就会很棒.我还订阅了root/users以查看是否会给我所有更改,这意味着我只能订阅6个单独的日历.
我正在使用官方的PHP库,但假设/希望无所谓.
我目前正在使用outlook mail api来检索来自特定共享文件夹(List Messages Request)的消息,当我从查询中得到响应时我想读取正文内容,在这种情况下我的标题更喜欢html.
我想要实现的是从HTML响应中替换字符串.
问题出在我的共享电子邮件中,我有这样的事情:
Hello [UserName], further text in mail message, Regards [CompanyName].
Run Code Online (Sandbox Code Playgroud)
我从api得到的响应看起来像这样:
<p class=\"MsoNormal\">Hello [<span class=\"SpellE\">UserName</span>],</p><p class=\"MsoNormal\"> </p><p class=\"MsoNormal\">further text in mail message, Regards [CompanyName].</p>
Run Code Online (Sandbox Code Playgroud)
响应显示我的字符串放置文本之一返回了拼写错误,而不是另一个,这不是理想的,因为我不想依赖我编写一些代码来检查是否:
[<span class=\"SpellE\">UserName</span>]
Run Code Online (Sandbox Code Playgroud)
存在与否,主要是因为这可能会在任何给定时间发生变化,这将是对系统的重大改变.
有什么办法可以禁用在html中返回的拼写检查吗?
我们使用Microsoft Graph API在Outlook中创建日历
以下是HTTP请求
POST https://graph.microsoft.com/v1.0/users/me/calendars
Content-type: application/json
{
"name": "My Calendar"
}
Run Code Online (Sandbox Code Playgroud)
最近两年来一直在工作。突然它抛出一个错误
{
"error": {
"code": "TargetIdShouldNotBeMeOrWhitespace",
"message": "Id is malformed.",
"innerError": {
"request-id": "78bce863-d6fb-4ea9-b0f8-e5097010cef6",
"date": "2019-03-23T11:54:34"
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我们搜索文档时(https://docs.microsoft.com/zh-cn/graph/api/user-post-calendars?view=graph-rest-1.0)。我们发现API网址已更改
何时推出像这样的重要更新而导致流程中断?
是否有任何官方频道/群组通知这些更改。
邮件API的Microsoft Graph API的类似问题-SendMail http 400-文档中的API网址不起作用
我正在尝试构建一个简单的Ruby应用程序,它可以连接到Microsoft Graph API并获取有关用户的基本信息,例如经理或直接下属.
我已经按照0365教程,我有一个能够获得用户邮件的工作应用程序.但是,当我尝试使用会话令牌查询图api时,我收到一个错误:
response.body
=> "{\r\n \"error\": {\r\n \"code\": \"InvalidAuthenticationToken\",\r\n \"message\": \"Access token validation failure.\",\r\n \"innerError\": {\r\n \"request-id\": \"18cbc6be-5254-400c-9780-7427376587fb\",\r\n \"date\": \"2016-06-30T22:21:55\"\r\n }\r\n }\r\n}"
Run Code Online (Sandbox Code Playgroud)
我正在使用示波器
SCOPES = [ 'openid', 'profile', 'https://outlook.office.com/contacts.read', 'offline_access' ]
Run Code Online (Sandbox Code Playgroud)
我刚刚被建议包括范围' https://graph.microsoft.com/user.read ',但是当我将其添加到应用程序时,我甚至在点击用户登录页面之前得到以下错误:
AADSTS70011: The provided value for the input parameter 'scope' is not valid. The scope openid profile offline_access https://graph.microsoft.com/user.read is not valid.
Run Code Online (Sandbox Code Playgroud)
任何有关这方面的帮助将不胜感激!
microsoft-graph ×10
office365 ×4
azure ×2
c# ×2
javascript ×2
fs ×1
node.js ×1
office365api ×1
outlook ×1
outlook-api ×1
php ×1