Office365 Outllok加载项REST调用:RequestBroker ParseUri--";未找到段';消息'&引用;
我遵循了这份文件 ,并在rest api调用时收到错误:Office365 Outllok加载项REST调用:RequestBroker ParseUri--";未找到段';消息'&引用;,office365,outlook-addin,office-js,outlook-restapi,Office365,Outlook Addin,Office Js,Outlook Restapi,我遵循了这份文件 ,并在rest api调用时收到错误: {"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}} 令牌和消息ID的值正确,代码来自文档,我唯一替换的是默认值为Office.context.mailbox.restUrl的https://outlook.office.com因为第一个对我来说是空的(为什么?) {"error":{"
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
令牌和消息ID的值正确,代码来自文档,我唯一替换的是默认值为Office.context.mailbox.restUrl的https://outlook.office.com
因为第一个对我来说是空的(为什么?)
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
实际代码:
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
function getItemRestId() {
// Currently the only Outlook Mobile version that supports add-ins
// is Outlook for iOS.
if (Office.context.mailbox.diagnostics.hostName === 'OutlookIOS') {
// itemId is already REST-formatted
return Office.context.mailbox.item.itemId;
} else {
// Convert to an item ID for API v2.0
return Office.context.mailbox.convertToRestId(
Office.context.mailbox.item.itemId,
Office.MailboxEnums.RestVersion.v2_0
);
}
}
function getCurrentItem(accessToken) {
var itemId = getItemRestId();
var getMessageUrl = 'https://outlook.office.com' +
'/api/v2.0/messages/' + itemId;
$.ajax({
url: getMessageUrl,
dataType: 'json',
headers: { 'Authorization': 'Bearer ' + accessToken }
}).done(function(item){
var subject = item.Subject;
}).fail(function(error){
// log error is here
});
}
Office.context.mailbox.getCallbackTokenAsync({isRest: true}, function(result){
if (result.status === "succeeded") {
var accessToken = result.value;
// Use the access token
getCurrentItem(accessToken);
} else {
// Handle the error
}
});
我做错了什么?你认为这是因为我替换了restUrl
value吗?我使用自定义域电子邮件
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
谢谢你抽出时间 由于您没有从restUrl属性获取值,我怀疑您正在使用on-prem Exchange服务器。这是一个有预装配的系统。这也是为什么使用
https://outlook.office.com
无法工作(您的服务器不在该URI上)
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
您可以使用配置绕过此问题。这允许您对本地服务器执行Microsoft Graph API调用。也就是说,我没有尝试过这个,所以在这种情况下它可能不起作用。考虑到所有这些组件(1.5和Hybrid)都在预览中,意外的结果总是意料之中的 我也面临同样的问题
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
我曾经
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
var getMessageUrl = 'https://outlook.office.com/api/v2.0/me/messages/'+ itemId+"/attachments";
而不是下面的url:
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}
var getMessageUrl = 'https://outlook.office.com/api/v2.0/messages/' + itemId;
API在使用第一个API后给出了正确的响应。我也面临同样的问题。谁能帮我一下吗?
{"error":{"code":"RequestBroker-ParseUri","message":"Resource not found for the segment 'messages'."}}